Bluetooth and bind
name.addressFamily = AF_BTH; name.btAddr = 0; name.serviceClassId = GUID_NULL; name.port = number of service channel, 0 or BT_PORT_ANY;
On client applications, the port member must be zero to enable an appropriate local endpoint to be assigned. On server applications, the port member must be a valid port number or BT_PORT_ANY; ports automatically assigned using BT_PORT_ANY may be queried subsequently with a call to the getsockname function. The valid range for requesting a specific RFCOMM port is 1 through 30. Server channels are global resource, and only 30 server channels are available for RFCOMM on any Bluetooth device, which must be shared by all Windows Sockets that belong to the Bluetooth address family. If no server channel is available, or if the specified server channel is already reserved, the bind call fails.
Upon successful return from bind, the server channel is reserved until the socket is closed. Use the getsockname function to retrieve the channel number for SDP registration.
Applications should use auto-allocation for the server channel.
Build date: 11/26/2013