StreamSocketListener.BindEndpointAsync(HostName, String) Method

Definition

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

public:
 virtual IAsyncAction ^ BindEndpointAsync(HostName ^ localHostName, Platform::String ^ localServiceName) = BindEndpointAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction BindEndpointAsync(HostName const& localHostName, winrt::hstring const& localServiceName);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction BindEndpointAsync(HostName localHostName, string localServiceName);
function bindEndpointAsync(localHostName, localServiceName)
Public Function BindEndpointAsync (localHostName As HostName, localServiceName As String) As IAsyncAction

Parameters

localHostName
HostName

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

localServiceName
String

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

Returns

IAsyncAction

An asynchronous bind operation on a StreamSocketListener object.

Attributes

Windows requirements

App capabilities
ID_CAP_NETWORKING [Windows Phone] internetClientServer privateNetworkClientServer

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.

Applies to

See also