Lines Matching refs:port

18 /// Internet socket addresses consist of an [IP address], a 16-bit port number, as well
35 /// assert_eq!(socket.port(), 8080);
51 /// IPv4 socket addresses consist of an [`IPv4` address] and a 16-bit port number, as
72 /// assert_eq!(socket.port(), 8080);
78 port: u16,
83 /// IPv6 socket addresses consist of an [`IPv6` address], a 16-bit port number, as well
105 /// assert_eq!(socket.port(), 8080);
111 port: u16,
117 /// Creates a new socket address from an [IP address] and a port number.
128 /// assert_eq!(socket.port(), 8080);
136 pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
138 IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
139 IpAddr::V6(a) => SocketAddr::V6(SocketAddrV6::new(a, port, 0, 0)),
183 (self_, new_ip) => *self_ = Self::new(new_ip, self_.port()),
187 /// Returns the port number associated with this socket address.
195 /// assert_eq!(socket.port(), 8080);
203 pub const fn port(&self) -> u16 {
205 SocketAddr::V4(ref a) => a.port(),
206 SocketAddr::V6(ref a) => a.port(),
210 /// Changes the port number associated with this socket address.
219 /// assert_eq!(socket.port(), 1025);
281 /// Creates a new socket address from an [`IPv4` address] and a port number.
298 pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
299 SocketAddrV4 { ip, port }
338 /// Returns the port number associated with this socket address.
346 /// assert_eq!(socket.port(), 8080);
354 pub const fn port(&self) -> u16 {
355 self.port
358 /// Changes the port number associated with this socket address.
367 /// assert_eq!(socket.port(), 4242);
371 self.port = new_port;
376 /// Creates a new socket address from an [`IPv6` address], a 16-bit port number,
398 pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
401 port,
443 /// Returns the port number associated with this socket address.
451 /// assert_eq!(socket.port(), 8080);
459 pub const fn port(&self) -> u16 {
460 self.port
463 /// Changes the port number associated with this socket address.
472 /// assert_eq!(socket.port(), 4242);
476 self.port = new_port;
594 /// `u16` is treated as port of the newly created [`SocketAddr`].
619 .then(self.port().cmp(&other.port()))
628 .then(self.port().cmp(&other.port()))
635 (self.port, self.ip).hash(s)
641 (self.port, &self.ip, self.flowinfo, self.scope_id).hash(s)