iOS Guides | Samples

Network Namespace

Modern networking library.


The Network framwork is an advanced alterantive to Sockets as made avaialble under System.Net.Sockets which is suitable for use in mobile application with demanding network capabilities.   The framework is designed to solve these problems:

  • Establishing a connection over different transports, automatically handling hostnames that have both IPV4 and IPV6 addresses, supporting Bonjour connections and Proxy Automatic Configuration (PAC)
  • A callback based approach for performing non-blocking IO.
  • Easily support for encryption and authentication over your network connections using TLS.
  • Being mobile friendly, coping with turning on the cellular radio on demand, supporting multi-path connections that can move from one network interface to another and providing a built-in reconnection and connection monitoring service.

The Network framework also features a modern architecture that makes it faster than the traditional socket API on Apple platforms.

To create an outgoing network connection, use the NWConnection class.

To accept incoming network connections, use the NWListener class.


NWConnectionRepresents a bidirectional network connection.
NWConnectionReceiveCompletionSignature for receiving data from NWConnection’s NWConnection.Receive or NWConnection.ReceiveMessage method.
NWConnectionReceiveDispatchDataCompletionSignature for receiving data from NWConnection’s NWConnection.ReceiveData or NWConnection.ReceiveMessageData method.
NWConnectionStateDescribes the state of the network connection, provided to your state changed handler in your NWConnection.
NWEndpointEndpoints represent a remote resource either a specific host and port or a service exposed via Bonjour (a zero-configuration network service discovery system)
NWEndpointTypeSupported endpoint types for a network connection.
NWErrorUsed to describe networking errors on established connections.
NWInterfaceTypeDescribes the possible networking interface types.
NWIPEcnFlagFlags set on IP packets for Explicit Congestion Notification
NWIPVersionDesired IP Version for the Protocol Options
NWListenerStateEnumerates the states of a NWListener object.
NWMultiPathServiceThe possible options on the NWParameters that control how to treat multi-path service.
NWParametersManages the parameters for a connection.   Use one of the Create factory methods to create a configured instance of NWParameters.
NWParametersExpiredDnsBehaviorEnumerates possible behaviors after DNS expiration.
NWPathDescribes the networking path in use.
NWPathMonitorObserves a NWPath and allows for monitoring and reacting to changes.
NWPathStatusStates for the network path, describing whether it is possible to send data over a path.
NWProtocolDefinitionA predefined network protocol that can be compared with others.
NWProtocolMetadataMetadata for network protocols.
NWProtocolOptionsContains a network protocol and its optional characteristics.
NWProtocolStackContainer for NWProtocolOptions objects.
NWServiceClassEnumerates the supported classes of service.