Share via


StreamSocketListener.BindServiceNameAsync Méthode

Définition

Surcharges

BindServiceNameAsync(String)

Démarre une opération de liaison d’un StreamSocketListener à un nom de service local.

BindServiceNameAsync(String, SocketProtectionLevel)

Démarre une opération de liaison sur un StreamSocketListener à un nom de service local avec un SocketProtectionLevel spécifié à définir sur tous les sockets liés.

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Démarre une opération de liaison de socket sur un StreamSocketListener à un nom de service local sur une carte réseau spécifiée avec un SocketProtectionLevel spécifié à définir sur tous les sockets liés.

BindServiceNameAsync(String)

Démarre une opération de liaison d’un StreamSocketListener à un nom de service local.

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

Paramètres

localServiceName
String

Platform::String

winrt::hstring

Nom de service local ou port TCP sur lequel lier l’objet StreamSocketListener . Pour Bluetooth RFCOMM, ce paramètre est l’ID de service Bluetooth.

Retours

Opération de liaison asynchrone sur un objet StreamSocketListener .

Attributs

Remarques

La méthode BindServiceNameAsync(String) se lie aux adresses IP locales de toutes les interfaces réseau sur l’ordinateur local et au nom de service local ou au port TCP spécifié dans le paramètre localServiceName . Si le paramètre localServiceName est une chaîne vide, le système sélectionne le port TCP local à lier.

Pour Bluetooth RFCOMM, cette méthode est liée à l’ID de service Bluetooth spécifié dans le paramètre localServiceName sur toutes les interfaces Bluetooth. Un ID de service Bluetooth doit être fourni pour la liaison pour Bluetooth.

La méthode BindServiceNameAsync(String) échoue si une autre application (un autre StreamSocketListener, par exemple) a déjà été liée au port TCP local ou à l’ID de service Bluetooth spécifié dans le paramètre localServiceName .

Voir aussi

S’applique à

BindServiceNameAsync(String, SocketProtectionLevel)

Démarre une opération de liaison sur un StreamSocketListener à un nom de service local avec un SocketProtectionLevel spécifié à définir sur tous les sockets liés.

public:
 virtual IAsyncAction ^ BindServiceNameAsync(Platform::String ^ localServiceName, SocketProtectionLevel protectionLevel) = BindServiceNameAsync;
/// [Windows.Foundation.Metadata.Overload("BindServiceNameWithProtectionLevelAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction BindServiceNameAsync(winrt::hstring const& localServiceName, SocketProtectionLevel const& protectionLevel);
[Windows.Foundation.Metadata.Overload("BindServiceNameWithProtectionLevelAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction BindServiceNameAsync(string localServiceName, SocketProtectionLevel protectionLevel);
function bindServiceNameAsync(localServiceName, protectionLevel)
Public Function BindServiceNameAsync (localServiceName As String, protectionLevel As SocketProtectionLevel) As IAsyncAction

Paramètres

localServiceName
String

Platform::String

winrt::hstring

Nom de service local ou port TCP sur lequel lier l’objet StreamSocketListener . Pour Bluetooth RFCOMM, ce paramètre est l’ID de service Bluetooth.

protectionLevel
SocketProtectionLevel

Niveau de protection pour le chiffrement à définir sur tous les sockets liés.

Retours

Opération de liaison asynchrone sur un objet StreamSocketListener .

Attributs

Remarques

La méthode [BindServiceNameAsync(String, SocketProtectionLevel) est liée aux adresses IP locales de toutes les interfaces réseau sur l’ordinateur local et au nom de service local ou au port TCP spécifié dans le paramètre localServiceName . Pour Bluetooth RFCOMM, cette méthode est liée à l’ID de service Bluetooth spécifié dans le paramètre localServiceName sur toutes les interfaces Bluetooth. Cette méthode définit le niveau de protection pour le chiffrement sur tous les sockets liés au paramètre protectionLevel .

Si le paramètre localServiceName est une chaîne vide, le système sélectionne le port TCP local à lier. Un ID de service Bluetooth doit être fourni pour la liaison pour Bluetooth.

La méthode [BindServiceNameAsync(String, SocketProtectionLevel) échoue si une autre application (un autre StreamSocketListener, par exemple) a déjà été liée au port TCP local ou à l’ID de service Bluetooth spécifié dans le paramètre localServiceName .

Le paramètre protectionLevel doit être défini sur PlainSocket pour tous les sockets, à l’exception de ceux utilisés via Bluetooth. Lorsque le socket doit être utilisé via Bluetooth, le paramètre protectionLevel peut être défini sur PlainSocket, BluetoothEncryptionAllowNullAuthentication ou BluetoothEncryptionWithAuthentication. Pour plus d’informations, consultez l’énumération SocketProtectionLevel .

Voir aussi

S’applique à

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Démarre une opération de liaison de socket sur un StreamSocketListener à un nom de service local sur une carte réseau spécifiée avec un SocketProtectionLevel spécifié à définir sur tous les sockets liés.

public:
 virtual IAsyncAction ^ BindServiceNameAsync(Platform::String ^ localServiceName, SocketProtectionLevel protectionLevel, NetworkAdapter ^ adapter) = BindServiceNameAsync;
/// [Windows.Foundation.Metadata.Overload("BindServiceNameWithProtectionLevelAndAdapterAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction BindServiceNameAsync(winrt::hstring const& localServiceName, SocketProtectionLevel const& protectionLevel, NetworkAdapter const& adapter);
[Windows.Foundation.Metadata.Overload("BindServiceNameWithProtectionLevelAndAdapterAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction BindServiceNameAsync(string localServiceName, SocketProtectionLevel protectionLevel, NetworkAdapter adapter);
function bindServiceNameAsync(localServiceName, protectionLevel, adapter)
Public Function BindServiceNameAsync (localServiceName As String, protectionLevel As SocketProtectionLevel, adapter As NetworkAdapter) As IAsyncAction

Paramètres

localServiceName
String

Platform::String

winrt::hstring

Nom de service local ou port TCP sur lequel lier l’objet StreamSocketListener . Pour Bluetooth RFCOMM, ce paramètre est l’ID de service Bluetooth.

protectionLevel
SocketProtectionLevel

Niveau de protection pour le chiffrement à définir sur tous les sockets liés.

adapter
NetworkAdapter

Carte réseau sur laquelle lier l’objet StreamSocketListener .

Retours

Opération de liaison asynchrone sur un objet StreamSocketListener .

Attributs

Remarques

La méthode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) est liée au nom de service local ou au port TCP spécifié dans le paramètre localServiceName sur la carte réseau spécifiée dans le paramètre de l’adaptateur sur l’ordinateur local. Pour Bluetooth RFCOMM, cette méthode est liée à l’ID de service Bluetooth spécifié dans le paramètre localServiceName si le paramètre de l’adaptateur est null. Un ID de service Bluetooth doit être fourni pour la liaison pour Bluetooth. Si une carte réseau est spécifiée dans le paramètre de l’adaptateur et que le paramètre localServiceName contient un ID de service Bluetooth, cette méthode échoue.

Cette méthode définit le niveau de protection pour le chiffrement sur tous les sockets liés au paramètre protectionLevel .

Si le paramètre localServiceName est une chaîne vide, le système sélectionne le port TCP local à lier. Si le paramètre d’adaptateur est null pour une liaison de socket TCP, une erreur se produit.

Le mécanisme de résolution de noms utilisé par la méthode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) est limité à l’interface spécifiée pour l’espace de noms DNS (Domain Name System).

La méthode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) échoue si une autre application (un autre StreamSocketListener, par exemple) a déjà été liée au port TCP local spécifié dans le paramètre localServiceName sur la carte réseau spécifiée dans le paramètre d’adaptateur . Pour Bluetooth, cette méthode échoue si une autre application (par exemple, une autre application StreamSocketListener) a déjà été liée à l’ID de service Bluetooth spécifié dans le paramètre localServiceName .

L’utilisation de la carte réseau spécifiée est optimale. Un système avec des cartes configurées en mode hôte faible ou de transfert peut utiliser une carte autre que l’adaptateur spécifié.

Le paramètre protectionLevel doit être défini sur PlainSocket pour tous les sockets, à l’exception de ceux utilisés via Bluetooth. Lorsque le socket doit être utilisé via Bluetooth, le paramètre protectionLevel peut être défini sur PlainSocket, BluetoothEncryptionAllowNullAuthentication ou BluetoothEncryptionWithAuthentication. Pour plus d’informations, consultez l’énumération SocketProtectionLevel .

Voir aussi

S’applique à