要大胆尝试,多看看msdn吧 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_BTH type [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. Res 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.
没学会走,就想跑
还有就是API的不同的。。Linux纯C接口的,还有Windows的WSA的等等。
http://download.csdn.net/detail/geoff08zhang/4571358
http://bbs.csdn.net/topics/390257815
要大胆尝试,多看看msdn吧
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_BTH
type
[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. Res
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.