SOCKADDR_BTH structure (ws2bth.h)

The SOCKADDR_BTH structure is used in conjunction with Bluetooth socket operations, defined by address family AF_BTH.

Syntax

typedef struct _SOCKADDR_BTH {
  USHORT   addressFamily;
  BTH_ADDR btAddr;
  GUID     serviceClassId;
  ULONG    port;
} SOCKADDR_BTH, *PSOCKADDR_BTH;

Members

addressFamily

Address family of the socket. This member is always AF_BTH.

btAddr

Address of the target Bluetooth device. When used with the bind function, must be zero or a valid local radio address. If zero, a valid local Bluetooth device address is assigned when the connect or accept function is called. When used with the connect function, a valid remote radio address must be specified.

serviceClassId

Service Class Identifier of the socket. When used with the bind function, serviceClassId is ignored. Also ignored if the port is specified. For the connect function, specifies the unique Bluetooth service class ID of the service to which it wants to connect. If the peer device has more than one port that corresponds to the service class identifier, the connect function attempts to connect to the first valid service; this mechanism can be used without prior SDP queries.

port

RFCOMM channel associated with the socket. See Remarks.

Remarks

When used with the bind function on client applications, the port member must be zero to enable an appropriate local endpoint to be assigned. When used with bind 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.

When using the connect function when serviceClassId is not provided, the port should directly specify the remote port number to which a connect operation is requested. Using the port member instead of the serviceClassId member requires the application to perform its own service (SDP) search before attempting the connect operation.

Requirements

Requirement Value
Minimum supported client Windows Vista, Windows XP with SP2 [desktop apps only]
Minimum supported server None supported
Header ws2bth.h

See also

Bluetooth and bind

Bluetooth and getsockname

Bluetooth and accept

Bluetooth and connect