See Also: BluetoothServerSocket Members
A listening Bluetooth socket.
The interface for Bluetooth Sockets is similar to that of TCP sockets: Java.Net.Socket and Java.Net.ServerSocket. On the server side, use a Android.Bluetooth.BluetoothServerSocket to create a listening server socket. When a connection is accepted by the Android.Bluetooth.BluetoothServerSocket, it will return a new Android.Bluetooth.BluetoothSocket to manage the connection. On the client side, use a single Android.Bluetooth.BluetoothSocket to both initiate an outgoing connection and to manage the connection.
The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth. It is also known as the Serial Port Profile (SPP).
To create a listening Android.Bluetooth.BluetoothServerSocket that's ready for incoming connections, use BluetoothAdapter.ListenUsingRfcommWithServiceRecord(string, Java.Util.UUID). Then call BluetoothServerSocket.Accept to listen for incoming connection requests. This call will block until a connection is established, at which point, it will return a Android.Bluetooth.BluetoothSocket to manage the connection. Once the Android.Bluetooth.BluetoothSocket is acquired, it's a good idea to call BluetoothServerSocket.Close on the Android.Bluetooth.BluetoothServerSocket when it's no longer needed for accepting connections. Closing the Android.Bluetooth.BluetoothServerSocket will not close the returned Android.Bluetooth.BluetoothSocket.
Android.Bluetooth.BluetoothServerSocket is thread safe. In particular, BluetoothServerSocket.Close will always immediately abort ongoing operations and close the server socket.
Note: Requires the NoType:android/Manifest$permission;Href=../../../reference/android/Manifest.permission.html#BLUETOOTH permission.
For more information about using Bluetooth, read the Bluetooth developer guide.