This project has moved. For the latest updates, please go here.

32feet.NET - User's Guide / Tutorial / Examples

Version 3.5, June 2012

Class Library reference documentation


There are generally five ways an application might want to use Bluetooth:

1. Make a direct data connection
Where the program connects directly to a Bluetooth RFCOMM service, and sends and receives the raw data for that connection. See section General Bluetooth Data Connections below. The BluetoothClient provides the Stream to read and write on -- there is no need to use virtual COM ports and the System.IO.Ports.SerialPort class. The server side function can also be provided. Our recommendation is that only if you are setting up the connection for a separate program that uses COM ports do you need to use virtual COM ports, see 1b.

1b. Virtual Serial Port
If however you have a separate third-party application that needs to use a virtual COM port then it is not quite so simple and direct. See Bluetooth Serial Ports.

Note that RFCOMM/SPP only allows one connection from a remote device to each service. So do not use BluetoothClient and a virtual Serial port to connect to the same service at the same time; the second one will fail to connect.

2. Do an OBEX transfer
Where the program is an OBEX client and connects to a server, and sends (PUTs) or GETs a file/object. The server side function can also be provided. See section OBEX below.

3. Have the Bluetooth stack and/or the OS connect to and use a remote service
Common services for this case are where the service is Headset/Handsfree/A2DP, or networking for instance. Here we do not want the program to connect directly to those services, as we wouldn’t know what to do with the raw bytes, but instead want the OS to send audio to the headset, or form a network connection with an access-point or similar. See section Connecting to Bluetooth Services below.

4. Make a direct data connection using the L2CAP protocol
Where the program connects directly to a Bluetooth L2CAP service, and sends and receives the raw data for that connection. We have pre-release support for this on some platforms see section Bluetooth L2CAP below,

5. Check whether a particular device is in range
The best way to do this is to attempt to open a connection to a service on the device and see if it succeeds. One service that is always present is SDP so do a fake SDP query, see section Testing if a device is in range below. If a device comes into range but neither it nor the local device attempt a connection nor are running discovery, then neither will know they are in range.

As noted there, we have support for most of those currently. See Profiles and 32feet.NET.html for information on what services use which method.

For device discovery see the section under General Bluetooth Data Connections below.


Last edited Jan 4, 2014 at 11:46 AM by alanjmcf, version 58


pevevalson Jul 28, 2015 at 1:04 PM 
Hi Alan ! I've read over and over your doc. I still don't understand how can I do want I want to do ( maybe it's an 18 inch problem :P )
I have a bluetooth device ( a Pebble Watch ) that I want to send SMS to. Once the SMS was read / receive, the watch should enable the possibility to send back an acknowledge that the owner of the watch had read the SMS. In other word : (C# program) -- SMS --> Pebble watch (once the SMS is read, a button will be pressed to send an acknowledgement) -- acknowledgement --> (C# program)

Is this something doable with your 32Feet.Net ? if yes, can you help me please ?

alanjmcf Jul 24, 2011 at 9:41 AM 
Yup 64-bit is supported on desktop Windows. See e.g. [Microsoft] and [Widcomm] in the help above. Follow-up in the forum if you are having problems.

mdheerajgupta Jul 21, 2011 at 1:55 PM 
Do we have this code in 64 bit too......