Import std.net.address
SocketAddress
struct
Public Struct SocketAddress Implements Hashable, Comparable, Printable
An IpAddress with a port: where a socket connects to or listens on. An IPv6 one can have a scope, its zone's index, for a link-local address, as in [fe80::1%3]:80.
Examples
Local server = SocketAddress.Parse("[::1]:8080")
Expect(server?.Port == 8080 && server?.Family == IpFamily.V6)
Expect("{SocketAddress(IpAddress.Loopback, 80)}" == "127.0.0.1:80")-
Its address.
-
Its port.
-
An IPv6 link-local address's scope, its zone's index, or 0 for none.
-
The
addressatport, and for an IPv6 link-local one, thescopeIdof its interface. Panics for a ScopeId on an IPv4address, which has none. -
The address
textwrites as ToString does: an IPv4 address and its port, as in 127.0.0.1:80, or an IPv6 one in brackets, with its scope's number after a %, as in [::1]:80 and [fe80::1%3]:80. Null for anything else, a scope's name like %eth0 too. -
Its address's family.
-
The address and its port, as "127.0.0.1:8080" for IPv4, or "[::1]:8080" for IPv6, with "%" and its scope ID inside the brackets when it has one.
-
Whether
acomes beforeb: by their addresses, then their ports, then their scope IDs.
Report an issue with this page or with FutureBlitz on GitHub.