Provides access to hostnames and endpoints used by network apps.
The Windows.Networking namespace has these types of members:
|EndpointPair||Provides data for the local endpoint and remote endpoint for a network connection used by network apps.|
|HostName||Provides data for a hostname or an IP address.|
The Windows.Networking namespace has these enumerations.
|DomainNameType||The domain type of the HostName object when the HostNameType is a domain name.|
|HostNameSortOptions||Options for how a list of EndpointPair objects is sorted.|
|HostNameType||The type of a HostName object.|
The Windows.Networking namespace provides classes that are used to initialize and provide data for a hostname or IP address and for a network endpoint pair used in network apps. The HostName and EndpointPair objects are used by many classes in other related namespaces. These include the following:
- Classes in the Windows.Networking.Sockets namespace used for network apps using sockets and WebSockets.
- The NetworkInformation Class in the Windows.Networking.Connectivity namespace.
On Windows Server 2012, the Windows.Networking.dll that implements the classes in the Windows.Networking namespace will fail to load unless the Media Foundation feature is enabled. As a result, apps using classes in the Windows.Networking namespace will fail if the Media Foundation feature is disabled (the default on Windows Server 2012).
The Media Foundation feature can be enabled on Windows Server 2012 using Server Manager or by entering the follow command in a CMD window or a script.
dism /online /enable-feature /featurename:ServerMediaFoundation
The user is prompted to reboot after the Media Foundation feature is enabled on Windows Server 2012. Once the computer is rebooted, classes in the Windows.Networking namespace will work as expected.
The network isolation feature in Windows 8 enables a developer to fully control the network access of a Windows Store app. Not all apps may require access to the network. However for those apps that do, the Windows 8 provides different levels of access to the network that can be enabled by selecting appropriate capabilities.
Network isolation allows a developer to define for each app the scope of required network access. An app without the appropriate scope defined is prevented from accessing the specified type of network, and specific type of network request (outbound client-initiated requests or both inbound unsolicited requests and outbound client-initiated requests). The ability to set and enforce network isolation ensures that if an app does get compromised, it can only access networks where the app has explicitly been granted access. This significantly reduces the scope of the impact on other apps and on Windows.
Network isolation affects any methods and properties in the Windows.Networking.Sockets, Windows.Networking.BackgroundTransfer, Windows.Web.AtomPub, and Windows.Web.Syndication namespaces that try to access the network. Windows actively enforces network isolation. A call to a method or any access to a property in these namespaces that results in network access may fail because of network isolation if the appropriate network capability has not been enabled.
The network capabilities for an app are configured in the app manifest when the app is built. Network capabilities are usually added using Microsoft Visual Studio 2012 when developing the app. Network capabilities may also be set manually in the app manifest file using a text editor.
For more detailed information on network isolation, see the How to configure network isolation capabilities.
- How to configure network isolation capabilities
- StreamSocket sample (Windows 10)
- DatagramSocket sample (Windows 10)