Share via


StreamSocketInformation.LocalAddress Property

Definition

Gets the local IP address associated with a StreamSocket object.

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

Property Value

The local IP address or hostname.

Windows requirements

App capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

The LocalAddress property represents the local IP address the StreamSocket object is bound to after a connection is established.

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

If the local hostname or IP address passed to the ConnectAsync(EndpointPair) or ConnectAsync(EndpointPair, SocketProtectionLevel) method is null or the ConnectAsync(HostName, String) or ConnectAsync(HostName, String, SocketProtectionLevel) method is called, the system will determine the local IP address to bind to the StreamSocket object.

Applies to

See also