SocketExtensions.GetCurrentNetworkInterface Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets all available information about the network interface.
Namespace: Microsoft.Phone.Net.NetworkInformation
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
Syntax
<ExtensionAttribute> _
Public Shared Function GetCurrentNetworkInterface ( _
socket As Socket _
) As NetworkInterfaceInfo
public static NetworkInterfaceInfo GetCurrentNetworkInterface(
this Socket socket
)
Parameters
- socket
Type: System.Net.Sockets..::.Socket
The network interface for which to get the information.
Return Value
Type: Microsoft.Phone.Net.NetworkInformation..::.NetworkInterfaceInfo
All available information about the network interface. Use the InterfaceType and InterfaceSubtype properties to determine the network interface 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.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | socket is nullNothingnullptra null reference (Nothing in Visual Basic). |
NetworkException | socket is not bound. |
NetworkException | Unable to get the session handle for socket. |
NetworkException | socket is not connected. |
NetworkException | Unable to get the information for socket. |
Remarks
For more information about extension methods, see Extension Methods (C# Programming Guide) or How to: Call an Extension Method (Visual Basic).
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1
Platforms
Windows Phone