StreamSocketListener.BindServiceNameAsync Metode

Definisi

Overload

BindServiceNameAsync(String)

Memulai operasi pengikatan pada StreamSocketListener ke nama layanan lokal.

BindServiceNameAsync(String, SocketProtectionLevel)

Memulai operasi pengikatan pada StreamSocketListener ke nama layanan lokal dengan SocketProtectionLevel tertentu untuk diatur pada soket terikat apa pun.

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Memulai operasi pengikatan soket pada StreamSocketListener ke nama layanan lokal pada adaptor jaringan tertentu dengan SocketProtectionLevel tertentu untuk diatur pada soket terikat apa pun.

BindServiceNameAsync(String)

Memulai operasi pengikatan pada StreamSocketListener ke nama layanan lokal.

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

Parameter

localServiceName
String

Platform::String

winrt::hstring

Nama layanan lokal atau port TCP untuk mengikat objek StreamSocketListener . Untuk Bluetooth RFCOMM, parameter ini adalah ID Layanan Bluetooth.

Mengembalikan

Operasi pengikatan asinkron pada objek StreamSocketListener .

Atribut

Keterangan

Metode BindServiceNameAsync(String) mengikat ke alamat IP lokal semua antarmuka jaringan di komputer lokal dan ke nama layanan lokal atau port TCP yang ditentukan dalam parameter localServiceName . Jika parameter localServiceName adalah string kosong, maka sistem akan memilih port TCP lokal untuk mengikat.

Untuk Bluetooth RFCOMM, metode ini mengikat ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName pada semua antarmuka Bluetooth. ID Layanan Bluetooth harus disediakan untuk mengikat Bluetooth.

Metode BindServiceNameAsync(String) akan gagal jika aplikasi lain ( StreamSocketListener lain, misalnya) telah terikat ke port TCP lokal atau ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName .

Lihat juga

Berlaku untuk

BindServiceNameAsync(String, SocketProtectionLevel)

Memulai operasi pengikatan pada StreamSocketListener ke nama layanan lokal dengan SocketProtectionLevel tertentu untuk diatur pada soket terikat apa pun.

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

Parameter

localServiceName
String

Platform::String

winrt::hstring

Nama layanan lokal atau port TCP untuk mengikat objek StreamSocketListener . Untuk Bluetooth RFCOMM, parameter ini adalah ID Layanan Bluetooth.

protectionLevel
SocketProtectionLevel

Tingkat perlindungan untuk enkripsi yang akan diatur pada soket terikat apa pun.

Mengembalikan

Operasi pengikatan asinkron pada objek StreamSocketListener .

Atribut

Keterangan

Metode [BindServiceNameAsync(String, SocketProtectionLevel) mengikat ke alamat IP lokal semua antarmuka jaringan di komputer lokal dan ke nama layanan lokal atau port TCP yang ditentukan dalam parameter localServiceName . Untuk Bluetooth RFCOMM, metode ini mengikat ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName pada semua antarmuka Bluetooth. Metode ini menetapkan tingkat perlindungan untuk enkripsi pada soket terikat apa pun ke parameter protectionLevel .

Jika parameter localServiceName adalah string kosong, maka sistem akan memilih port TCP lokal untuk mengikat. ID Layanan Bluetooth harus disediakan untuk mengikat Bluetooth.

Metode [BindServiceNameAsync(String, SocketProtectionLevel) akan gagal jika aplikasi lain ( StreamSocketListener lain, misalnya) telah terikat ke port TCP lokal atau ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName .

Parameter protectionLevel harus diatur ke PlainSocket untuk semua soket kecuali yang digunakan melalui Bluetooth. Ketika soket akan digunakan melalui Bluetooth, parameter protectionLevel dapat diatur ke PlainSocket, BluetoothEncryptionAllowNullAuthentication, atau BluetoothEncryptionWithAuthentication. Untuk informasi selengkapnya, lihat enumerasi SocketProtectionLevel .

Lihat juga

Berlaku untuk

BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter)

Memulai operasi pengikatan soket pada StreamSocketListener ke nama layanan lokal pada adaptor jaringan tertentu dengan SocketProtectionLevel tertentu untuk diatur pada soket terikat apa pun.

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

Parameter

localServiceName
String

Platform::String

winrt::hstring

Nama layanan lokal atau port TCP untuk mengikat objek StreamSocketListener . Untuk Bluetooth RFCOMM, parameter ini adalah ID Layanan Bluetooth.

protectionLevel
SocketProtectionLevel

Tingkat perlindungan untuk enkripsi yang akan diatur pada soket terikat apa pun.

adapter
NetworkAdapter

Adaptor jaringan untuk mengikat objek StreamSocketListener .

Mengembalikan

Operasi pengikatan asinkron pada objek StreamSocketListener .

Atribut

Keterangan

Metode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) mengikat ke nama layanan lokal atau port TCP yang ditentukan dalam parameter localServiceName pada adaptor jaringan yang ditentukan dalam parameter adaptor pada komputer lokal. Untuk Bluetooth RFCOMM, metode ini mengikat KE ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName jika parameter adaptornull. ID Layanan Bluetooth harus disediakan untuk mengikat Bluetooth. Jika adaptor jaringan ditentukan dalam parameter adaptor dan parameter localServiceName berisi ID Layanan Bluetooth, maka metode ini akan gagal.

Metode ini menetapkan tingkat perlindungan untuk enkripsi pada soket terikat apa pun ke parameter protectionLevel .

Jika parameter localServiceName adalah string kosong, maka sistem akan memilih port TCP lokal untuk mengikat. Jika parameter adaptornull untuk ikatan soket TCP, kesalahan akan terjadi.

Mekanisme resolusi nama yang digunakan oleh metode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) terbatas pada antarmuka yang ditentukan untuk namespace layanan sistem nama domain (DNS).

Metode [BindServiceNameAsync(String, SocketProtectionLevel, NetworkAdapter) akan gagal jika aplikasi lain ( StreamSocketListener lain, misalnya) telah terikat ke port TCP lokal yang ditentukan dalam parameter localServiceName pada adaptor jaringan yang ditentukan dalam parameter adaptor . Untuk Bluetooth, metode ini akan gagal jika aplikasi lain ( StreamSocketListener lain, misalnya) telah terikat ke ID Layanan Bluetooth yang ditentukan dalam parameter localServiceName .

Menggunakan adaptor jaringan yang ditentukan adalah berdasarkan upaya terbaik. Sistem dengan adaptor yang dikonfigurasi dalam mode host lemah atau penerusan dapat menggunakan adaptor selain adaptor yang ditentukan.

Parameter protectionLevel harus diatur ke PlainSocket untuk semua soket kecuali yang digunakan melalui Bluetooth. Ketika soket akan digunakan melalui Bluetooth, parameter protectionLevel dapat diatur ke PlainSocket, BluetoothEncryptionAllowNullAuthentication, atau BluetoothEncryptionWithAuthentication. Untuk informasi selengkapnya, lihat enumerasi SocketProtectionLevel .

Lihat juga

Berlaku untuk