An operation was attempted on something that was not a socket

Topics: Bluetooth - BlueSoliel
Oct 12, 2012 at 6:14 PM

I have had issues with the Microsoft stack where I am getting an invalid address that was in fact discovered. This occurred in approx 3% of my sessions. I wanted to see if this problem would go away with the Bluesoleil stack.

The code I am using works fine on the Microsoft stack but fails with:

InTheHand.Net.Bluetooth.BlueSoleil.BlueSoleilSocketException: An operation was attempted on something that is not a socket (BlueSoleil: OPERATION_FAILURE (0x0302)).
   at InTheHand.Net.Bluetooth.BlueSoleil.BluesoleilUtils.CheckAndThrow(BtSdkError ret, String descr)
   at InTheHand.Net.Bluetooth.BlueSoleil.BluesoleilClient.ConnectRfcomm(BluetoothEndPoint remoteEP, UInt32 hDev, UInt32& hConn, Byte& channel, Int32& comPort)
   at InTheHand.Net.Bluetooth.BlueSoleil.BluesoleilClient.Connect(BluetoothEndPoint remoteEP)
   at InTheHand.Net.Sockets.BluetoothClient.Connect(BluetoothEndPoint remoteEP)
   at InTheHand.Net.Sockets.BluetoothClient.Connect(BluetoothAddress address, Guid service)
   at myCode

manager.Connect(myDevice.DeviceAddress, BluetoothService.RFCommProtocol);

The discovery works as expected, but the connect is failing. I tried using a serial port service, but it failed as well. Is it possible to establish a RFCommProtocol connection? I am using product version 3.3.909.0

Oct 16, 2012 at 1:12 PM

I have resolved my issues with the Microsoft stack. I am not going to pursue this issue. Please disregard.

Oct 19, 2012 at 1:35 PM

I've been so busy I haven't been able to spend any time here. I'm pleased you solved you MSFT issues.

The problem here was likely with using "BluetoothService.RFCommProtocol);"  It is never valid to use RFCommProtocol from []:

"(Do not use BluetoothService.RFCommProtocol that is pointless, BluetoothClient always uses RFCOMM)."

BlueSoleil in particular is touchy about which UUIDs it connects to so could well be the problem here []:

"However connections can’t be made to profiles that BlueSoleil supports directly, for instance an RFCOMM connection to OBEX Push isn’t possible. Nor is it it possible to make a connection to a specific RFCOMM port number. Connects to service class SerialPort (0x1101) did not work prior to version 3.2"