Bluetooth NETCF

Bluetooth Socket Options on Windows XP

Windows XP supports a much smaller number of socket options for Bluetooth than Windows CE, although it generally provides alternative ways to get/set those properties. The table below shows those that are supported on XP and how they relate to their Windows CE equivalent. Notice that the only one which behaves the same on both platforms is SO_BTH_ENCRYPT

Windows XP

Windows CE

#define SO_BTH_AUTHENTICATE 0x80000001  // optlen=sizeof(ULONG), optval = &(ULONG)TRUE/FALSE

#define SO_BTH_AUTHENTICATE                                    0x00000001    // optlen=0, optval ignored

#define SO_BTH_ENCRYPT      0x00000002  // optlen=sizeof(ULONG), optval = &(ULONG)TRUE/FALSE

#define SO_BTH_ENCRYPT                                               0x00000002    // optlen=sizeof(unsigned int), optval = &(unsigned int)TRUE/FALSE

#define SO_BTH_MTU          0x80000007  // optlen=sizeof(ULONG), optval = &mtu


#define SO_BTH_SET_MTU                                                0x00000006    // unconnected only! optlen=sizeof(unsigned int), optval = &mtu

#define SO_BTH_GET_MTU                                               0x00000007    // optlen=sizeof(unsigned int), optval = &mtu

#define SO_BTH_MTU_MAX      0x80000008  // optlen=sizeof(ULONG), optval = &max. mtu


#define SO_BTH_SET_MTU_MAX                                    0x00000008    // unconnected only! optlen=sizeof(unsigned int), optval = &max. mtu

#define SO_BTH_GET_MTU_MAX                                    0x00000009    // bound only! optlen=sizeof(unsigned int), optval = &max. mtu

#define SO_BTH_MTU_MIN      0x8000000a  // optlen=sizeof(ULONG), optval = &min. mtu

#define SO_BTH_SET_MTU_MIN                          0x0000000a    // unconnected only! optlen=sizeof(unsigned int), optval = &min. mtu

#define SO_BTH_GET_MTU_MIN                         0x0000000b    // bound only! optlen=sizeof(unsigned int), optval = &min. mtu

The current version of the Bluetooth.NET library doesn’t include the XP versions in the BluetoothSocketOptionName enumeration, but I have added these for the next release.

By Peter Foot

Microsoft Windows Development MVP

2 replies on “Bluetooth Socket Options on Windows XP”

Hello Peter

I just posted another question on another post today but i just realized that i need Microsoft Bluetooth Stack. Where can I get this is there a trial download or does it have to be purchased? Do you know any links that would take me there?

Thanks alot

Halil Deniz

Depending on your device you either have it built in or not, there isn’t a way to change this. On the desktop the Microsoft stack is included on XP SP1 and above, and if your bluetooth hardware is supported you can uninstall the Widcomm/Broadcom etc software and let windows install the default stack. On some devices you may need to install an alternative driver/utility to enable this for example Toshiba supply their own stack on the Portege M200, but this can be uninstalled and they have a utility which you can run to enable the standard MS stack.

Comments are closed.