I'm trying to communicate with a bluetooth device as a client using 32feet.NET. The device is actually a microcontroller with a bluetooth module but currently I'm using my windows phone for testing. The devices are already paired and here's what I did. (devinfo is the DeviceInfo of the selected device)
private void ClientConnect()
{
var client = new BluetoothClient();
client.SetPin("pin used for pairing");
client.BeginConnect(devInfo.DeviceAddress, BluetoothService.SerialPort, BluetoothClientConnectCallback, client);
}
private void BluetoothClientConnectCallback(IAsyncResult ar)
{
var bluetoothClient = ar.AsyncState as BluetoothClient;
bluetoothClient.EndConnect(ar);
UpdateUI("Connected");
var stream = bluetoothClient.GetStream();
...
But at this point: bluetoothClient.EndConnect(ar); I always get a SocketException mostly saying: "The requested address is not valid in its context"
and rarely it says:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Could you suggest something that might cause the issue?