StreamSocketListener.BindEndpointAsync(HostName, String) StreamSocketListener.BindEndpointAsync(HostName, String) StreamSocketListener.BindEndpointAsync(HostName, String) StreamSocketListener.BindEndpointAsync(HostName, String) StreamSocketListener.BindEndpointAsync(HostName, String) Method

Definition

Starts a bind operation on a StreamSocketListener to a local hostname and a local service name.

public : IAsyncAction BindEndpointAsync(HostName localHostName, Platform::String localServiceName)
IAsyncAction BindEndpointAsync(HostName localHostName, winrt::hstring localServiceName) const;
public IAsyncAction BindEndpointAsync(HostName localHostName, String localServiceName)
Public Function BindEndpointAsync(localHostName As HostName, localServiceName As String) As IAsyncAction
Windows.Networking.Sockets.StreamSocketListener.bindEndpointAsync(localHostName, localServiceName).done( /* Your success and error handlers */ );

Parameters

localHostName
HostName HostName HostName

The local hostname or IP address on which to bind the StreamSocketListener object.

localServiceName
String String String

The local service name or TCP port on which to bind the StreamSocketListener object.

Returns

An asynchronous bind operation on a StreamSocketListener object.

Additional features and requirements

Capabilities
ID_CAP_NETWORKING [Windows Phone] privateNetworkClientServer internetClientServer

Remarks

The BindEndpointAsync method binds a StreamSocketListener object to a specific hostname or IP address specified in the localHostName parameter and the local service name or TCP port specified in the localServiceName parameter. If the localHostName parameter is null, then the system will select the local IP address to bind to the StreamSocketListener object . If the localServiceName parameter contains an empty string, then the system will select the local TCP port to bind to the StreamSocketListener object.

The BindEndpointAsync method will fail if another app using TCP (another StreamSocketListener, for example) has already been bound to the local IP address and TCP port specified in the localHostName and localServiceName parameters.

See also