Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Embedded
Windows Embedded CE
Windows CE 5.0
Windows CE Features
Bluetooth
 Winsock Extensions
Platform Builder for Microsoft Windows CE 5.0
Winsock Extensions
Send Feedback

Using Bluetooth through Winsock interfaces is common to all socket-based programming.

The server creates the socket, binds it to a given RFCOMM channel, exports the SDP record advertising this channel, and then listens for incoming connections. The following code example shows how this is done.

SOCKET s = socket(...);
bind(s, ...);
listen(s, ...);
for(; ;){
   SOCKET s2= accept(s, ...);
   SpinThreadsForConnection(s2);
}

The client then creates the socket, connects it to the server using a known server channel obtained from the SDP query or a UUID of the target service, and then starts sending and receiving requests. The following code snippet demonstrates how this is done.

SOCKET s = socket(...);
connect(s, ...);
send(s, ...);        // send request
recv(s, ...);        // get response
closesocket(s);    // done

Winsock Function Extensions

To establish a Bluetooth connection using the Winsock interface, use the following extensions:

See Also

Bluetooth Application Development


Send Feedback on this topic to the authors

Feedback FAQs


© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker