SocketExtensions.SetNetworkPreference Method

July 28, 2014

Sets the preference for a network interface to use either cellular or non-cellular technology.

Namespace:  Microsoft.Phone.Net.NetworkInformation
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

public static void SetNetworkPreference(
	this Socket socket,
	NetworkSelectionCharacteristics preference
)

Parameters

socket
Type: System.Net.Sockets.Socket
The network interface for which to set the preference.
preference
Type: Microsoft.Phone.Net.NetworkInformation.NetworkSelectionCharacteristics
One of the enumeration values that specify the preferred type of technology.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Socket. When you use instance method syntax to call this method, omit the first parameter.

ExceptionCondition
ArgumentNullException

socket is null.

NetworkException

socket is already bound.

NetworkException

Unable to get the session handle for socket.

NetworkException

Unable to set the network preference.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2014 Microsoft