Class

NWTCPConnection

An object to manage a TCP connection, with or without TLS.

Declaration

@interface NWTCPConnection : NSObject

Topics

Monitoring the Connection Status

state

The status of the connection

NWTCPConnectionState

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

viable

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

error

The connection-wide error property

Transferring Data

- readLength:completionHandler:

Read a certain number of bytes on a connection

- write:completionHandler:

Write the data to the connection.

- writeClose

Close the connection for writing

Canceling the Connection

- cancel

Cancel the connection

Responding to Network Changes

hasBetterPath

If a connection has a better path, new connections would use a different interface

- initWithUpgradeForConnection:

This convenience initializer can be used to create a new connection that wil only be connected if there exists a better path (as determined by the system) to the remote endpoint of the original connection.

Getting Connection Properties

endpoint

The destination endpoint with which this connection was created

localAddress

The IP address endpoint from which the connection was established

remoteAddress

The IP address endpoint to which the connection was established

connectedPath

The network path over which the connection was established

txtRecord

The TXT record associated with a connected Bonjour service endpoint

Relationships

Inherits From

See Also

TCP Connections

NWTLSParameters

TLS properties for creating a connection.

NWTCPConnectionAuthenticationDelegate

A delegate protocol to customize the TLS authentication done by a connection.

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