socket (Bluetooth) (Windows CE 5.0)
This function creates a socket that is bound to a specific service provider.
Note This function is actually a Winsock function. However, the information that is presented in it is specific to Bluetooth.
SOCKET socket(int af,int type,int protocol);
Parameters
af
[in] Address family specification. To create a Bluetooth socket, use: af = AF_BTHtype
[in] Type specification for the new socket. To create a Bluetooth socket, use:type = SOCK_STREAM
protocol
[in] Protocol to be used with the socket that is specific to the indicated address family. To create a Bluetooth socket, use:protocol = BTHPROTO_RFCOMM
Return Values
If no error occurs, this function returns a descriptor referencing the new socket. If an error occurs, a value of INVALID_SOCKET is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Remarks
The following example code shows how to use socket to create a Bluetooth socket.
SOCKET s = socket (AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
For more information about the socket function, see socket (Windows Sockets) in the Winsock reference.
Requirements
OS Versions: Windows CE .NET 4.0 and later.
Header: Winsock2.h.
Link Library: Ws2.lib.
See Also
Bluetooth Application Development Functions | Winsock Extensions
Send Feedback on this topic to the authors