StreamSocketListener.BindEndpointAsync | bindEndpointAsync method

Applies to Windows and Windows Phone

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

Syntax


streamSocketListener.bindEndpointAsync(localHostName, localServiceName).done( /* Your success and error handlers */ );

Parameters

localHostName

Type: HostName

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

localServiceName

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

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

Return value

Type: IAsyncAction

An asynchronous bind operation on a StreamSocketListener object.

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.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8

Namespace

Windows.Networking.Sockets
Windows::Networking::Sockets [C++]

Metadata

Windows.winmd

DLL

Windows.Networking.dll

Capabilities

internetClientServer
privateNetworkClientServer
ID_CAP_NETWORKING [Windows Phone]

See also

BindServiceNameAsync
HostName
StreamSocketListener
StreamSocketListenerInformation

 

 

Show:
© 2014 Microsoft. All rights reserved.