Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

bluetooth device Error 'Java.IO.IOException: read failed, socket might closed or timeout'

$
0
0

On attempting to connect to a zebra bluetooth enabled scanner getting the error Java.IO.IOException: read failed, socket might closed or timeout.

Have read similar issues in forums and attempted many of the suggested ideas but none seem to help and stuck on this now for a while now.

        BluetoothDevice test = inRangeBluetoothDevicesCollection.ToList().ElementAt(index);
        test.CreateBond();

        UUID uuid = UUID.FromString("00001101-0000-1000-8000-00805F9B34FB");

        ParcelUuid[] UUID2 = test.GetUuids();

        Java.Lang.Reflect.Method mi = test.Class.GetMethod("createRfcommSocket", new Java.Lang.Class[] { Java.Lang.Integer.Type });

        // have tried all three methods of setting up BluetoothSocket but no joy with any
        BluetoothSocket BthSocket = test.CreateRfcommSocketToServiceRecord(UUID2[0].Uuid);
   //BluetoothSocket BthSocket = (Android.Bluetooth.BluetoothSocket)mi.Invoke(test, 1);
        //BluetoothSocket BthSocket = test.CreateRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805F9B34FB"));
        mBluetoothAdapter.CancelDiscovery();
        if (!BthSocket.IsConnected)
        {
            try
            {
       //error here
                BthSocket.Connect();
            }
            catch (Exception ex)
            {
            }
        }

Have spent a lot of time on this already, any help is really appreciated, thanks.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>