Bluetooth Programming with Windows Sockets
This section describes how to use Windows Sockets functions and structures to program a Bluetooth application. Complete reference information for the Windows Sockets API elements can be found in Windows Sockets; this section provides only Bluetooth-specific information for each Windows Sockets programming element.
You can also download the Bluetooth connection sample for a complete example.
As with all Windows Sockets application programming, the WSAStartup function must be called to initiate Windows Sockets functionality and enable Bluetooth.
The following topics provide guidance in the use of Windows Sockets functions and structures with the Microsoft Bluetooth API:
|Bluetooth and accept||
Bluetooth uses the accept function to enable incoming connection attempts on a socket.
|Bluetooth and bind||
Bluetooth uses the bind function to bind to a socket.
|Bluetooth and BLOB|
|Bluetooth and connect||
Bluetooth uses the connect function to connect to a target Bluetooth device, using a previously created Bluetooth socket.
|Bluetooth and getaddrinfo||
The getaddrinfo function provides translation from host name to address for IP-based transports.
|Bluetooth and getpeername||
Used to retrieve the Bluetooth address of the peer Bluetooth device.
|Bluetooth and getsockname|
|Bluetooth and getsockopt||
Bluetooth uses the getsockopt function to query various parameters associated with the server channel or the connection.
|Bluetooth and listen, select, and closesocket|
|Bluetooth and read or write operations||
Details the supported Winsock read and write operations.
|Bluetooth and setsockopt||
Bluetooth uses the setsockopt function to set various parameters associated with the server channel or the connection.
|Bluetooth and shutdown||
Bluetooth uses the shutdown function to disconnect from the remote radio.
|Bluetooth and socket||
Bluetooth uses the socket function creates a socket for incoming or outgoing connections.
|Bluetooth and Socket Options||
Details the socket options supported by Microsoft Bluetooth.
|Bluetooth and WSAAddressToString|
|Bluetooth and WSALookupServiceBegin||
Bluetooth uses the WSALookupServiceBegin function to query for devices and to discover services.
|Bluetooth and WSALookupServiceNext|
|Bluetooth and WSALookupServiceEnd|
|Bluetooth and WSAQUERYSET||
The WSAQUERYSET structure is used in operations including device inquiry, service inquiry, and setting the service.
|Bluetooth and WSASetService||
Bluetooth uses the WSASetService function to register or remove a service instance within the Bluetooth namespace (NS_BTH) from the registry.