Cannot establish connection unlesss COM port assigned?

Topics: Bluetooth - Microsoft
Feb 4, 2012 at 2:31 PM


I am attempting to establish a connection to a RN-42 Bluetooth Chip located on a circuit board. I have successfully been able to connect, read, and write steam data to this chip without a problem using the InTheHand library using VB.NET

I have come across one problem however, and this is when I attempt to programatically connect to the Bluetooth device before a COM Port has been established for the device. Here are some examples of what I am talking about:

When going into 'Bluetooth Places', then browsing to the device, this is what will be shown when a fresh discover for the first time has been done for this device (as you can see there is no COM Port assigned to this device yet in Windows).

When no COM Port is established, this is the error I receive when attempting to establish a connection programatically:

The error reads:

An operation was attempted on something that is not a socket (BlueSoleil: OPERATION_FAILURE (0x0302)).


However, when I establish a COM Port by right clicking the 'Bluetooth Serial Port' item from 'Bluetooth Places', then select 'Connect', windows will bring up a small window stating that it is assigning a COM Port. Shortly afterwards, a COM Port will be assigned to the device and a connection will be made.

Here is a picture of the device after it has a COM Port established:


Is it possible for me to accomplish this COM Port assignment using the 32feet development kit? Or any other easy way programatically for that matter?

Feb 5, 2012 at 8:56 PM

This looks like its with the BlueSoleil stack?  So if you don't need the profile support etc that it provides and need the programmatic access then the simplest solution might be to reconfigure your PC so that the Microsoft stack is being used instead.  (Presumably re-config by Device Manager, select the dongle, do change driver and select the Microsoft driver).

For BlueSoleil use, what version of 32feet.NEt library are you using? 3.3?  Connecting to a SPP service didn't work before v3.2 AFAICS.  See e.g. workitem 30163 (  See also and the various notes referenced there.

Feb 7, 2012 at 3:15 PM
Edited Feb 8, 2012 at 6:00 AM

Yes I am using the BlueSoleil stack.. I'm going to try and fight with this for a bit. I've manged to do everything but assign a COM port to a discovered device.

Feb 8, 2012 at 12:13 PM

Do you want the COM port?  Or do you just want to use BluetoothClient.Connect and the stream from GetStream?

If the former you can do btDevInfo.SetServiceState(SerialPort, true)  That should create a COM port.

See and