kvarn_async::prelude::compact_str::core::net

Struct SocketAddrV4

1.77.0 · source
pub struct SocketAddrV4 { /* private fields */ }
Expand description

An IPv4 socket address.

IPv4 socket addresses consist of an IPv4 address and a 16-bit port number, as stated in IETF RFC 793.

See SocketAddr for a type encompassing both IPv4 and IPv6 socket addresses.

The size of a SocketAddrV4 struct may vary depending on the target operating system. Do not assume that this type has the same memory layout as the underlying system representation.

§Examples

use std::net::{Ipv4Addr, SocketAddrV4};

let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0