SetNetworkPreference Method
Collapse the table of content
Expand the table of content

SocketExtensions.SetNetworkPreference Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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)

'Declaration
<ExtensionAttribute> _
Public Shared Sub SetNetworkPreference ( _
	socket As Socket, _
	preference As NetworkSelectionCharacteristics _
)

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 Nothing.

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:
© 2017 Microsoft