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.
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.| Exception | Condition |
|---|---|
| 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. |
For more information about extension methods, see Extension Methods (C# Programming Guide) or How to: Call an Extension Method (Visual Basic).