StreamSocketListener.BindServiceNameAsync StreamSocketListener.BindServiceNameAsync StreamSocketListener.BindServiceNameAsync StreamSocketListener.BindServiceNameAsync StreamSocketListener.BindServiceNameAsync Method

Definition

Overloads

BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String)

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

BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel)

Starts a bind operation on a StreamSocketListener to a local service name with a specified SocketProtectionLevel to set on any bound sockets.

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Starts a socket bind operation on a StreamSocketListener to a local service name on a specified network adapter with a specified SocketProtectionLevel to set on any bound sockets.

BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String) BindServiceNameAsync(String)

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

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

Parameters

localServiceName
String String String

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

Returns

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.

See also

BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel) BindServiceNameAsync(String, SocketProtectionLevel)

Starts a bind operation on a StreamSocketListener to a local service name with a specified SocketProtectionLevel to set on any bound sockets.

public : IAsyncAction BindServiceNameAsync(Platform::String localServiceName, SocketProtectionLevel protectionLevel)
IAsyncAction BindServiceNameAsync(winrt::hstring localServiceName, SocketProtectionLevel protectionLevel) const;
public IAsyncAction BindServiceNameAsync(String localServiceName, SocketProtectionLevel protectionLevel)
Public Function BindServiceNameAsync(localServiceName As String, protectionLevel As SocketProtectionLevel) As IAsyncAction
Windows.Networking.Sockets.StreamSocketListener.bindServiceNameAsync(localServiceName, protectionLevel).done( /* Your success and error handlers */ );

Parameters

localServiceName
String String String

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

protectionLevel
SocketProtectionLevel SocketProtectionLevel SocketProtectionLevel

The protection level for encryption to set on any bound sockets.

Returns

The asynchronous bind operation on a StreamSocketListener object.

Remarks

The [BindServiceNameAsync(String, SocketProtectionLevel) 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. For Bluetooth RFCOMM, this method binds to the Bluetooth Service ID specified in the localServiceName parameter on all Bluetooth interfaces. This method sets the protection level for encryption on any bound sockets to the protectionLevel parameter.

If the localServiceName parameter is an empty string, then the system will select the local TCP port on which to bind. A Bluetooth Service ID must be supplied to bind for Bluetooth.

The [BindServiceNameAsync(String, SocketProtectionLevel) 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.

The protectionLevel parameter must be set to PlainSocket for all sockets except those used over Bluetooth. When the socket is to be used over Bluetooth, the protectionLevel parameter can be set to PlainSocket, BluetoothEncryptionAllowNullAuthentication, or BluetoothEncryptionWithAuthentication. For more information, see the SocketProtectionLevel enumeration.

See also

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Starts a socket bind operation on a StreamSocketListener to a local service name on a specified network adapter with a specified SocketProtectionLevel to set on any bound sockets.

public : IAsyncAction BindServiceNameAsync(Platform::String localServiceName, SocketProtectionLevel protectionLevel, NetworkAdapter adapter)
IAsyncAction BindServiceNameAsync(winrt::hstring localServiceName, SocketProtectionLevel protectionLevel, NetworkAdapter adapter) const;
public IAsyncAction BindServiceNameAsync(String localServiceName, SocketProtectionLevel protectionLevel, NetworkAdapter adapter)
Public Function BindServiceNameAsync(localServiceName As String, protectionLevel As SocketProtectionLevel, adapter As NetworkAdapter) As IAsyncAction
Windows.Networking.Sockets.StreamSocketListener.bindServiceNameAsync(localServiceName, protectionLevel, adapter).done( /* Your success and error handlers */ );

Parameters

localServiceName
String String String

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

protectionLevel
SocketProtectionLevel SocketProtectionLevel SocketProtectionLevel

The protection level for encryption to set on any bound sockets.

adapter
NetworkAdapter NetworkAdapter NetworkAdapter

The network adapter on which to bind the StreamSocketListener object.

Returns

The asynchronous bind operation on a StreamSocketListener object.

Remarks

The [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) method binds to the local service name or TCP port specified in the localServiceName parameter on the network adapter specified in the adapter parameter on the local computer. For Bluetooth RFCOMM, this method binds to the Bluetooth Service ID specified in the localServiceName parameter if the adapter parameter is null. A Bluetooth Service ID must be supplied to bind for Bluetooth. If a network adapter is specified in the adapter parameter and the localServiceName parameter contains a Bluetooth Service ID, then this method will fail.

This method sets the protection level for encryption on any bound sockets to the protectionLevel parameter.

If the localServiceName parameter is an empty string, then the system will select the local TCP port on which to bind. If the adapter parameter is null for a TCP socket bind, an error will occur.

The name resolution mechanism used by the [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) method is limited to the specified interface for the domain name system (DNS) namespace.

The [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) method will fail if another app (another StreamSocketListener, for example) has already been bound to the local TCP port specified in the localServiceName parameter on the network adapter specified in the adapter parameter. For Bluetooth, this method will fail if another app (another StreamSocketListener, for example) has already been bound to the Bluetooth Service ID specified in the localServiceName parameter.

Using the specified network adapter is on a best-effort basis. A system with adapters configured in weak-host or forwarding modes may use an adapter other than the specified adapter.

The protectionLevel parameter must be set to PlainSocket for all sockets except those used over Bluetooth. When the socket is to be used over Bluetooth, the protectionLevel parameter can be set to PlainSocket, BluetoothEncryptionAllowNullAuthentication, or BluetoothEncryptionWithAuthentication. For more information, see the SocketProtectionLevel enumeration.

See also