Bluetooth and bind

Bluetooth uses the bind function to bind to a socket. To bind a Bluetooth socket, call the bind function using the SOCKADDR_BTH structure. Use the SOCKADDR_BTH structure with the following settings:

name.addressFamily = AF_BTH;
name.btAddr = 0;
name.serviceClassId = NULL_GUID;
name.port = number of service channel, 0 or BT_PORT_ANY;

 

bind

The bind function associates a local address with a socket.

int bind(
  SOCKET s,
  const struct sockaddr* name,
  int namelen
);

Parameters

s

[in] Descriptor identifying an unbound socket.

name

[in] Address to assign to the socket from the sockaddr structure.

namelen

[in] Length of the value in the name parameter, in bytes.

Return Value

If no error occurs, bind returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be retrieved by calling WSAGetLastError.

 

 

Reference : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/bluetooth/bluetooth/discovering_bluetooth_devices_and_services.asp

 

Hosted by www.Geocities.ws

1