Type Method
ipv6(_:port:)
Creates an IPv6 socket address from a colon-notation string.
static func ipv6(_ host: String, port: UInt16) throws -> SocketAddress
Parameters
-
host
-
A numeric IPv6 address such as "::1" or "2001:db8::1". DNS names are not accepted; IPv4-mapped IPv6 ("::ffff:192.0.2.1") is accepted per RFC 4291 §2.5.5.2.
-
port
-
A port number in host byte order (1-65535).
Return Value
A ready-to-use SocketAddress backed by sockaddr_in6.
Mentioned In
Discussion
Throws
SocketError.invalidAddress(_:) if inet_pton(3) rejects host.
See Also
ipv4(_:port:), anyIPv4(port:).