Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

32feet .NET api refusing to connect "The requested address is not valid in its context"

I've been trying to fix this problem for an hour now and it's been giving me a headache. All I'm trying to do is connect a Bluetooth device to my application using the example on this page. When the .Connect function is called, a SocketException occurs saying "The requested address is not valid in its context".

I am positive the address of the device I'm pairing is correct; I even discovered devices and used an address from one of the found devices, yet I still got the same error. I've tried both BluetoothService.SerialPort and the MyConsts class example for the Guid, and both raised the same error.

The code I'm using is here:

BluetoothAddress addr = BluetoothAddress.Parse("78A2A0FC0BB1");
Guid serviceClass;
serviceClass = BluetoothService.SerialPort;
// - or - etc
// serviceClass = MyConsts.MyServiceUuid
//
var ep = new BluetoothEndPoint(addr, serviceClass);
var cli = new BluetoothClient();
cli.Connect(ep);
Stream peerStream = cli.GetStream();

I'm also using Visual Studio 2015.

like image 496
mitterdoo Avatar asked Oct 12 '25 04:10

mitterdoo


1 Answers

According the documentation it is not issue with the address itself but with services that are running on the device.

https://32feet.codeplex.com/wikipage?title=Errors

No Service with given Service Class Id is running on the remote device

Are you sure that device you are using has SerialPort profile running?

like image 144
Darko Djuric Avatar answered Oct 14 '25 19:10

Darko Djuric