Enumeration

NWTCPConnectionState

Defined connection states. New types may be defined in the future.

Declaration

enum NWTCPConnectionState : Int

Topics

Enumeration Cases

case invalid

The connection is in an invalid or uninitialized state.

case connecting

The connection is attempting to connect. This includes endpoint resolution when applicable.

case waiting

The connection has attempted to connect but failed. It is now waiting for better conditions before trying again.

case connected

The connection is established. It is now possible to transfer data. If TLS is in use, the TLS handshake has finished.

case disconnected

The connection is disconnected. It is no longer possible to transfer data. The application should call cancel to clean up resources.

case cancelled

The connection has been cancelled by the client calling cancel.

See Also

Monitoring the Connection Status

var state: NWTCPConnectionState

The status of the connection

var isViable: Bool

The viability of a TCP connection indicates whether or not data can be transferred

var error: Error?

The connection-wide error property

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