Export (0) Print
Expand All

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:

TopicDescription
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 uses the BLOB structure to pass or receive transport-specific data to the WSAQUERYSET structure during calls to the WSASetService or WSALookupService* functions.

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 uses the getsockname function to retrieve the server device address and port number allocated to a socket through a previous call to the bind function.

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 uses the listen, select, and closesocket functions without any modification from standard Windows Sockets programming.

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

Used to convert a Bluetooth Device Address to a string, which is in turn provided to the WSALookupServiceBegin function via the WSAQUERYSET structure when retrieving device service information.

Bluetooth and WSALookupServiceBegin

Bluetooth uses the WSALookupServiceBegin function to query for devices and to discover services.

Bluetooth and WSALookupServiceNext

Bluetooth uses the WSALookupServiceNext function to match queries specified in a previous call to WSALookupServiceBegin.

Bluetooth and WSALookupServiceEnd

Bluetooth uses the WSALookupServiceEnd function to terminate a query initiated in a previous call to WSALookupServiceBegin, and perhaps extended in subsequent calls to WSALookupServiceNext.

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.

 

Related topics

Windows Sockets

 

 

Community Additions

ADD
Show:
© 2014 Microsoft