1 out of 1 rated this helpful - Rate this topic

StreamSocketListener.BindServiceNameAsync(String) | bindServiceNameAsync(String) method

Applies to Windows and Windows Phone

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

Syntax


streamSocketListener.bindServiceNameAsync(localServiceName).done( /* Your success and error handlers */ );

Parameters

localServiceName

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

The local service name or TCP port on which to bind the StreamSocketListener object. For Bluetooth RFCOMM, this parameter is the Bluetooth Service ID.

Return value

Type: IAsyncAction

The asynchronous bind operation on a StreamSocketListener object.

Remarks

The BindServiceNameAsync(String) method binds to the local IP addresses of all network interfaces on the local computer and to the local service name or TCP port specified in the localServiceName parameter. If the localServiceName parameter is an empty string, then the system will select the local TCP port on which to bind.

For Bluetooth RFCOMM, this method binds to the Bluetooth Service ID specified in the localServiceName parameter on all Bluetooth interfaces. A Bluetooth Service ID must be supplied to bind for Bluetooth.

The BindServiceNameAsync(String) method will fail if another app (another StreamSocketListener, for example) has already been bound to the local TCP port or Bluetooth Service ID specified in the localServiceName parameter.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

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

Metadata

Windows.winmd

See also

BindEndpointAsync
BindServiceNameAsync(String, SocketProtectionLevel)
BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)
StreamSocketListener
StreamSocketListenerInformation

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.