Type Method
ipv4(_:port:)
Creates an IPv4 socket address from a dotted-quad string.
static func ipv4(_ host: String, port: UInt16) throws -> SocketAddress
Parameters
-
host
-
A numeric IPv4 address such as "127.0.0.1" or "192.168.1.1". DNS names are not accepted.
-
port
-
A port number in host byte order (1-65535).
Return Value
A ready-to-use SocketAddress backed by sockaddr_in.
Mentioned In
Discussion
Throws
SocketError.invalidAddress(_:) if inet_pton(3) rejects host.
See Also
ipv6(_:port:), anyIPv4(port:).