Bluetooth : RemoteService IsConnected() does not work correctly

Jan 28, 2011 at 4:03 PM

Hello. I have the following code:

 

            List<RemoteService> serviceList = bluetoothDeviceServicesManager1.DiscoverServicesByType(SelectedDevice, ServiceType.SerialPortProfile);
            RemoteService remoteService = null;

            try
            {
                remoteService = serviceList[0];
                if (remoteService.IsConnected())
                {
                    remoteService.Disconnect();
                    _stream = null;
                }
                _stream = remoteService.Connect();
            }
            catch (ServiceConnectionException servEx)
            {
            }

I get the remoteService.IsConnected() == false and exception

{"Unable to connect to service. Only one usage of each socket address (protocol/network address/port) is normally permitted C4F.DevKit.Bluetooth.ServiceAndDeviceDiscovery.BluetoothEndPoint"}

 

Why and how to do it correctly?