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


enum NWTCPConnectionState : Int


Connection States

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