Initializer

init(hostname:port:)

Create a host endpoint with a hostname and port.

Declaration

convenience init(hostname: String, port: String)

Parameters

hostname

A string representation of the hostname or address, such as www.example.com or 10.0.0.1.

port

A string containing the port on the host, such as 80.

Discussion

If the hostname is a domain name, such as www.example.com, starting a connection to the host endpoint causes the hostname to be resolved to an address during the connection process. If the hostname is an IPv4 or IPv6 address, such as 10.0.0.1 or fe80::1, starting a connection to the host endpoint will cause the address to be used directly.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software