DatagramSocketInformation.LocalPort Property

Definition

The local service name or UDP port number associated with a DatagramSocket.

public:
 property Platform::String ^ LocalPort { Platform::String ^ get(); };
winrt::hstring LocalPort();
public string LocalPort { get; }
var string = datagramSocketInformation.localPort;
Public ReadOnly Property LocalPort As String

Property Value

String

Platform::String

winrt::hstring

The local service name or UDP port number.

Windows requirements

App capabilities
ID_CAP_NETWORKING [Windows Phone]

Remarks

The LocalPort property represents the local service name or UDP port number bound to the DatagramSocket object.

An app can set the local service name or UDP port number to use by calling the BindEndpointAsync , BindServiceNameAsync, 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 service name or UDP port number passed to the BindEndpointAsync , BindServiceNameAsync, ConnectAsync(EndpointPair) , or GetOutputStreamAsync(EndpointPair) methods is an empty string or the ConnectAsync(HostName, String) or GetOutputStreamAsync(HostName, String) method is called, the system will determine the local UDP port to bind to the DatagramSocket object.

Applies to

See also