Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connection error #39

Open
sontqq opened this issue Jun 5, 2019 · 10 comments
Open

connection error #39

sontqq opened this issue Jun 5, 2019 · 10 comments

Comments

@sontqq
Copy link

sontqq commented Jun 5, 2019

Everytime I try to connect to a device i get:

error_read failed, socket might closed or timeout, read ret: -1

Any idea?

@omaraflak
Copy link
Owner

omaraflak commented Jun 5, 2019

What kind of the device are you trying to connect to ?

Take a look at this README section :
https://github.com/OmarAflak/Bluetooth-Library/blob/master/README.md#connect-to-device-using-port-trick

@sontqq
Copy link
Author

sontqq commented Jun 5, 2019

I'm trying to connect from an Android 9.0 Samsung device to a Windows 10 PC with a bluetooth dongle.

I have also tried to connect with the port tricking but no success.

@sontqq
Copy link
Author

sontqq commented Jun 6, 2019

I get this error:

W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothSocket android.bluetooth.BluetoothDevice.createRfcommSocketToServiceRecord(java.util.UUID)' on a null object reference
        at me.aflak.bluetooth.Bluetooth.connect(Bluetooth.java:462)
W/System.err:     at me.aflak.bluetooth.Bluetooth.connectToDevice(Bluetooth.java:271)
        at me.aflak.bluetooth.Bluetooth.connectToDevice(Bluetooth.java:279)
W/System.err:     at com.sontme.esp.getlocation.activities.MainActivity$3$2.onDiscoveryFinished(MainActivity.java:363)
        at me.aflak.bluetooth.Bluetooth$7$3.run(Bluetooth.java:597)
        at me.aflak.bluetooth.utils.ThreadHelper.run(ThreadHelper.java:15)
W/System.err:     at me.aflak.bluetooth.Bluetooth$7.onReceive(Bluetooth.java:594)
        at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1486)
        at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:873)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7073)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

@jpeiter
Copy link

jpeiter commented May 19, 2020

I'm having the same error, using either connectToDevice and connectToDeviceWithPortTrick, but fails every time.
I downloaded the Bluetooth Terminal app and it logs the same error on the screen.
I tried to connect from a Pixel 3 (Android 10) to a Galaxy J5 Pro (Android 9).

@glebkravchenko
Copy link

yep, same for me, trying to connect to medical device, but it is saying same, error_read failed, socket might closed or timeout, read ret: -1

@omaraflak
Copy link
Owner

Please make sure you are using a regular Bluetooth dongle, not BLE. BLE is not supported.

@charlieporth1
Copy link

charlieporth1 commented Dec 20, 2021

I'm getting this msg too. Is there any solution? Is there any way to disable BLE @omaraflak?

@ibrahim-iqbal
Copy link

ibrahim-iqbal commented Jan 10, 2022

This issue is still persistent, is there a workaround for this, none of the other libraries are also able to tackle this.

@skillhubz
Copy link

Everytime I try to connect to a device i get:

error_read failed, socket might closed or timeout, read ret: -1

Any idea?

no

@skillhubz
Copy link

Please make sure you are using a regular Bluetooth dongle, not BLE. BLE is not supported.

gotcha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants