DatagramSocketInformation.LocalAddress DatagramSocketInformation.LocalAddress DatagramSocketInformation.LocalAddress DatagramSocketInformation.LocalAddress DatagramSocketInformation.LocalAddress Property

Definition

The local IP address associated with a DatagramSocket object.

public : HostName LocalAddress { get; }
HostName LocalAddress();
public HostName LocalAddress { get; }
Public ReadOnly Property LocalAddress As HostName
var hostName = datagramSocketInformation.localAddress;

Property Value

The local hostname or IP address.

Additional features and requirements

Capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

The LocalAddress property represents the local IP address bound to the DatagramSocket object.

An app can set the local hostname or IP address to use by calling the BindEndpointAsync , ConnectAsync(EndpointPair) , or GetOutputStreamAsync(EndpointPair) methods on the DatagramSocket. The bind or connect operation will bind the socket to the specific local IP address and local UDP port number. After the bind or connect operation completes, LocalAddress property contains the IP address and the LocalPort property contains the local UDP port number that the local hostname and service name resolved to.

If the local hostname or IP address passed to the BindEndpointAsync , BindServiceNameAsync, ConnectAsync(EndpointPair) , or GetOutputStreamAsync(EndpointPair) methods is null or the ConnectAsync(HostName, String) or GetOutputStreamAsync(HostName, String) method is called, the system will determine the local IP address to bind to the DatagramSocket object.

See also