rohitsangwan01 / uni_control_hub

UniControlHub: Seamlessly Bridge Your Devices
http://www.rohitsangwan.in/apps/uni_control_hub/
GNU General Public License v3.0
90 stars 1 forks source link

SocketException #25

Open sdfg2 opened 2 months ago

sdfg2 commented 2 months ago


[2024-08-30T21:20:31] Info: Client 10.1.0.104:5555 is connected: true
[2024-08-30T21:20:31] Info: Synergy Client: Instance of 'SynergyClient'
[2024-08-30T21:20:31] Error: 10.1.0.104:5555: SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
 (OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
, errno = 10057), address = 0.0.0.0, port = 50735
[2024-08-30T21:20:31] Info: Client 10.1.0.104:5555 is connected: false
[2024-08-30T21:20:32] Info: Data from client: Failed to close uhid: close failed: EBADF (Bad file descriptor)
[2024-08-30T21:20:32] Debug: UniHubAndroidServer Stdout: Duplicate UHID id: 1Failed to close uhid: close failed: EBADF (Bad file descriptor)```

Version 0.0.8
rohitsangwan01 commented 2 months ago

@sdfg2 are you getting this error everytime ? are you able to use another USB mode ? Which platform and Android version you are using ? These might help me to narrow down the cause

gabrielnogueiracsc commented 2 months ago

i'm getting this error when try to use with IOS

rohitsangwan01 commented 2 months ago

@gabrielnogueiracsc can you also provide logs

nu00 commented 1 month ago

I also have the same problem with android devices, both using adb over wifi or over usb:

UniControlHub (v0.0.8) Logs: 

[2024-09-20T08:16:45] Info: Client LG-H840:LGH840809910d0 is connected: true
[2024-09-20T08:16:45] Info: Synergy Client: Instance of 'SynergyClient'
[2024-09-20T08:16:45] Error: LG-H840:LGH840809910d0: SocketException: Socket non connesso e indirizzo non fornito durante l'invio su un socket di datagramma che utilizza una chiamata sendto. Richiesta di invio o ricezione di dati annullata.
 (OS Error: Socket non connesso e indirizzo non fornito durante l'invio su un socket di datagramma che utilizza una chiamata sendto. Richiesta di invio o ricezione di dati annullata.
, errno = 10057), address = 0.0.0.0, port = 55758
[2024-09-20T08:16:45] Info: Client LG-H840:LGH840809910d0 is connected: false
nugs1913 commented 1 month ago

I'm on same situation.

UniControlHub (v0.0.8) Logs: 

[2024-09-29T00:21:41] Debug: Starting UsbDetection
[2024-09-29T00:21:41] Info: LibUsb Initialized for this platform
[2024-09-29T00:21:41] Info: Checking Adb Server
[2024-09-29T00:21:41] Info: Trying to start adb server
[2024-09-29T00:21:42] Info: Adb devices: [R3CT807D12P]
[2024-09-29T00:21:42] Info: Server started at 127.0.0.1:1913
[2024-09-29T00:21:42] Info: UHID Server started on port 1913
[2024-09-29T00:21:42] Info: Server pushed to R3CT807D12P, C:\Users\NUGS\AppData\Local\com.rohit\uni_control_hub\UniHubServer_0.1.jar: 1 file pushed, 0 skipped. 15.7 MB/s (3995 bytes in 0.000s)

[2024-09-29T00:21:42] Info: PortForwarding 
[2024-09-29T00:21:42] Info: Adb port forwarded: 1913
[2024-09-29T00:21:42] Info: Server setup done, waiting for response from R3CT807D12P
[2024-09-29T00:21:42] Debug: UniHubAndroidServer Stdout: Starting server... [-deviceId, R3CT807D12P, -localSocket, uni]

[2024-09-29T00:21:42] Info: Connection from 127.0.0.1:52270
[2024-09-29T00:21:42] Debug: UniHubAndroidServer Stdout: Thread started running..

[2024-09-29T00:21:42] Info: Data from client: device_id:R3CT807D12P
[2024-09-29T00:21:42] Info: Client connected: R3CT807D12P
[2024-09-29T00:21:42] Info: Synergy Server is not running
[2024-09-29T00:21:42] Info: Added Client R3CT807D12P
[2024-09-29T00:21:42] Info: Synergy Client: null
[2024-09-29T00:21:43] Info: Trying to Start
[2024-09-29T00:21:43] Info: Synergy Config: C:\Users\NUGS\AppData\Local\com.rohit\uni_control_hub\synergy.conf
[2024-09-29T00:21:43] Info: Server started with pid: 1236
[2024-09-29T00:21:43] NOTE: clipboard sharing is disabled
[2024-09-29T00:21:43] NOTE: started server, waiting for clients
[2024-09-29T00:21:45] Info: Client R3CT807D12P is connected: true
[2024-09-29T00:21:45] Info: Synergy Client: Instance of 'SynergyClient'
[2024-09-29T00:21:45] Error: R3CT807D12P: SocketException: 소켓이 연결되어 있지 않거나 Sendto 호출을 사용하여 데이터그램 소켓에 보내는 경우에 주소가 제공되지 않아서 데이터를 보내거나 받도록 요청할 수 없습니다.
 (OS Error: 소켓이 연결되어 있지 않거나 Sendto 호출을 사용하여 데이터그램 소켓에 보내는 경우에 주소가 제공되지 않아서 데이터를 보내거나 받도록 요청할 수 없습니다.
, errno = 10057), address = 0.0.0.0, port = 52271
[2024-09-29T00:21:45] Info: Client R3CT807D12P is connected: false
itsandr000 commented 2 weeks ago

I can't get it to work either, it eventually leads to the same socket error. I've tried over AOA and UHID. USB Debugging is enabled and I've tried different USB Cables.

UniControlHub (v0.0.8) Logs:

[2024-10-21T15:05:38] Debug: Starting UsbDetection [2024-10-21T15:05:38] Info: LibUsb Initialized for this platform [2024-10-21T15:05:38] Info: Trying to Start [2024-10-21T15:05:38] Info: Synergy Config: C:\Users\adl7\AppData\Local\com.rohit\uni_control_hub\synergy.conf [2024-10-21T15:05:38] Info: Server started with pid: 20476 [2024-10-21T15:05:38] NOTE: clipboard sharing is disabled [2024-10-21T15:05:38] NOTE: Scroll Lock is on, locking cursor to screen [2024-10-21T15:05:38] NOTE: started server, waiting for clients [2024-10-21T15:05:39] Info: Killing Adb Server (if any) [2024-10-21T15:05:40] Info: Killing Adb Server (if any) [2024-10-21T15:05:53] Info: Killing Adb Server (if any) [2024-10-21T15:05:54] Info: Killing Adb Server (if any) [2024-10-21T15:06:02] Info: Killing Adb Server (if any) [2024-10-21T15:06:04] Debug: UsbDevice: [] Connected: false [2024-10-21T15:06:04] Info: Killing Adb Server (if any) [2024-10-21T15:06:07] Debug: UsbDevice: [] Connected: true [2024-10-21T15:06:07] Info: Killing Adb Server (if any) [2024-10-21T15:06:08] Debug: UsbDevice: [] Connected: false [2024-10-21T15:06:08] Info: Killing Adb Server (if any) [2024-10-21T15:06:09] Debug: UsbDevice: [] Connected: true [2024-10-21T15:06:09] Info: Killing Adb Server (if any) [2024-10-21T15:06:50] Info: Killing Adb Server (if any) [2024-10-21T15:06:57] Info: Checking Adb Server [2024-10-21T15:06:58] Info: Trying to start adb server [2024-10-21T15:06:58] Error: UHID Error: Exception: 'adb' is not recognized as an internal or external command, operable program or batch file.

[2024-10-21T15:06:58] Info: Checking Adb Server [2024-10-21T15:06:58] Info: Trying to start adb server [2024-10-21T15:06:58] Error: UHID Error: Exception: 'adb' is not recognized as an internal or external command, operable program or batch file.

[2024-10-21T15:07:11] Info: Killing Adb Server (if any) [2024-10-21T15:07:13] Info: Killing Adb Server (if any) [2024-10-21T15:07:16] Debug: UsbDevice: [] Connected: false [2024-10-21T15:07:16] Info: Killing Adb Server (if any) [2024-10-21T15:07:19] Debug: UsbDevice: [] Connected: true [2024-10-21T15:07:19] Info: Killing Adb Server (if any) [2024-10-21T15:07:20] Debug: UsbDevice: [] Connected: false [2024-10-21T15:07:20] Info: Killing Adb Server (if any) [2024-10-21T15:07:21] Debug: UsbDevice: [] Connected: true [2024-10-21T15:07:21] Info: Killing Adb Server (if any) [2024-10-21T15:08:07] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:07] Info: Killing Adb Server (if any) [2024-10-21T15:08:13] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:13] Info: Killing Adb Server (if any) [2024-10-21T15:08:15] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:15] Info: Killing Adb Server (if any) [2024-10-21T15:08:15] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:15] Info: Killing Adb Server (if any) [2024-10-21T15:08:18] Info: Killing Adb Server (if any) [2024-10-21T15:08:28] Info: Killing Adb Server (if any) [2024-10-21T15:08:29] Info: Killing Adb Server (if any) [2024-10-21T15:08:34] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:34] Info: Killing Adb Server (if any) [2024-10-21T15:08:34] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:34] Info: Killing Adb Server (if any) [2024-10-21T15:08:35] Info: Killing Adb Server (if any) [2024-10-21T15:08:37] Info: Killing Adb Server (if any) [2024-10-21T15:08:37] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:37] Info: Killing Adb Server (if any) [2024-10-21T15:08:38] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:38] Info: Killing Adb Server (if any) [2024-10-21T15:08:38] Info: Killing Adb Server (if any) [2024-10-21T15:08:39] Info: Killing Adb Server (if any) [2024-10-21T15:08:42] Info: Killing Adb Server (if any) [2024-10-21T15:08:43] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:43] Info: Killing Adb Server (if any) [2024-10-21T15:08:43] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:43] Info: Killing Adb Server (if any) [2024-10-21T15:08:44] Info: Killing Adb Server (if any) [2024-10-21T15:08:45] Info: Killing Adb Server (if any) [2024-10-21T15:08:46] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:46] Info: Killing Adb Server (if any) [2024-10-21T15:08:46] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:46] Info: Killing Adb Server (if any) [2024-10-21T15:08:47] Info: Killing Adb Server (if any) [2024-10-21T15:08:48] Info: Killing Adb Server (if any) [2024-10-21T15:08:48] Info: Killing Adb Server (if any) [2024-10-21T15:08:49] Info: Killing Adb Server (if any) [2024-10-21T15:08:49] Info: Killing Adb Server (if any) [2024-10-21T15:08:49] Info: Killing Adb Server (if any) [2024-10-21T15:08:50] Info: Killing Adb Server (if any) [2024-10-21T15:08:50] Info: Killing Adb Server (if any) [2024-10-21T15:08:51] Info: Killing Adb Server (if any) [2024-10-21T15:08:53] Debug: UsbDevice: [] Connected: false [2024-10-21T15:08:53] Info: Killing Adb Server (if any) [2024-10-21T15:08:54] Debug: UsbDevice: [] Connected: true [2024-10-21T15:08:54] Info: Killing Adb Server (if any) [2024-10-21T15:08:54] Info: Killing Adb Server (if any) [2024-10-21T15:08:55] Info: Killing Adb Server (if any) [2024-10-21T15:09:20] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:20] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:20] Info: Killing Adb Server (if any) [2024-10-21T15:09:20] Info: Killing Adb Server (if any) [2024-10-21T15:09:23] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:23] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:23] Info: Killing Adb Server (if any) [2024-10-21T15:09:23] Info: Killing Adb Server (if any) [2024-10-21T15:09:24] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:24] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:24] Info: Killing Adb Server (if any) [2024-10-21T15:09:24] Info: Killing Adb Server (if any) [2024-10-21T15:09:24] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:24] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:24] Info: Killing Adb Server (if any) [2024-10-21T15:09:24] Info: Killing Adb Server (if any) [2024-10-21T15:09:29] Info: Killing Adb Server (if any) [2024-10-21T15:09:34] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:34] Info: Killing Adb Server (if any) [2024-10-21T15:09:34] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:34] Info: Killing Adb Server (if any) [2024-10-21T15:09:35] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:35] Info: Killing Adb Server (if any) [2024-10-21T15:09:35] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:35] Info: Killing Adb Server (if any) [2024-10-21T15:09:38] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:38] Info: Killing Adb Server (if any) [2024-10-21T15:09:38] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:38] Info: Killing Adb Server (if any) [2024-10-21T15:09:39] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:39] Info: Killing Adb Server (if any) [2024-10-21T15:09:39] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:39] Info: Killing Adb Server (if any) [2024-10-21T15:09:40] Info: Added Client SAMSUNG_Android:R52XA00K9BV [2024-10-21T15:09:40] Info: Synergy Client: Instance of 'SynergyClient' [2024-10-21T15:09:40] Error: SAMSUNG_Android:R52XA00K9BV: SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. (OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. , errno = 10057), address = 0.0.0.0, port = 54473 [2024-10-21T15:09:40] Info: Killing Adb Server (if any) [2024-10-21T15:09:43] Debug: UsbDevice: [] Connected: false [2024-10-21T15:09:43] Info: Killing Adb Server (if any) [2024-10-21T15:09:43] Debug: UsbDevice: [] Connected: true [2024-10-21T15:09:43] Info: Killing Adb Server (if any) [2024-10-21T15:09:43] Info: Added Client SAMSUNG_Android:R52XA00K9BV [2024-10-21T15:09:43] Info: Synergy Client: Instance of 'SynergyClient' [2024-10-21T15:09:43] Error: SAMSUNG_Android:R52XA00K9BV: SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. (OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. , errno = 10057), address = 0.0.0.0, port = 54482 [2024-10-21T15:09:45] Info: Client SAMSUNG_Android:R52XA00K9BV is connected: true [2024-10-21T15:09:45] Info: Client SAMSUNG_Android:R52XA00K9BV is connected: false [2024-10-21T15:09:47] Info: Killing Adb Server (if any) [2024-10-21T15:10:43] Info: Killing Adb Server (if any)

rohitsangwan01 commented 2 weeks ago

@itsandr000 is Adb configured on your system properly Are you able to use Adb via command line, logs says Adb not found Also was your Mobile and Desktop connected to same network ?

itsandr000 commented 2 weeks ago

Hi there,

I believe my ADB is configured properly. I followed the XDA guide: https://www.xda-developers.com/install-adb-windows-macos-linux/

I've also added the PATH variable. Nevertheless I would prefer to use the AOA method instead of UHID + ADB.

Mobile and Desktop are on the same LAN and subnet, but my desktop is using Ethernet when at home. When at Work they are on different VLANS but that shouldn't matter for AOA right?

Here are the latest logs (from my home).

UniControlHub (v0.0.8) Logs:

[2024-10-22T13:38:21] Debug: Starting UsbDetection [2024-10-22T13:38:21] Info: Killing previous process 25580 [2024-10-22T13:38:21] Info: 25580 Kill status: false [2024-10-22T13:38:21] Info: LibUsb Initialized for this platform [2024-10-22T13:38:21] Info: Killing previous process 25580 [2024-10-22T13:38:21] Info: 25580 Kill status: false [2024-10-22T13:38:21] Info: Trying to Start [2024-10-22T13:38:21] Info: Synergy Config: C:\Users\adl7\AppData\Local\com.rohit\uni_control_hub\synergy.conf [2024-10-22T13:38:21] Info: Address: 192.168.1.87:25800 [2024-10-22T13:38:21] Info: Server started with pid: 22884 [2024-10-22T13:38:21] NOTE: clipboard sharing is disabled [2024-10-22T13:38:21] NOTE: started server, waiting for clients [2024-10-22T13:38:22] Info: Checking Adb Server [2024-10-22T13:38:22] Info: Trying to start adb server [2024-10-22T13:38:22] Error: UHID Error: Exception: 'adb' is not recognized as an internal or external command, operable program or batch file.

[2024-10-22T13:38:33] Info: Killing Adb Server (if any) [2024-10-22T13:38:38] Debug: UsbDevice: [] Connected: false [2024-10-22T13:38:38] Info: Killing Adb Server (if any) [2024-10-22T13:38:41] Debug: UsbDevice: [] Connected: true [2024-10-22T13:38:41] Info: Killing Adb Server (if any) [2024-10-22T13:38:42] Info: Added Client SAMSUNG_Android:R52XA00K9BV [2024-10-22T13:38:42] Info: Synergy Client: Instance of 'SynergyClient' [2024-10-22T13:38:42] Error: SAMSUNG_Android:R52XA00K9BV: SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. (OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. , errno = 10057), address = 192.168.1.87, port = 62838 [2024-10-22T13:38:46] Info: Client SAMSUNG_Android:R52XA00K9BV is connected: true [2024-10-22T13:38:46] Info: Client SAMSUNG_Android:R52XA00K9BV is connected: false

rohitsangwan01 commented 2 weeks ago

@itsandr000 hard to guess with this info, main cause is

Error: SAMSUNG_Android:R52XA00K9BV: SocketException: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. (OS Error: A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied. , errno = 10057), address = 192.168.1.87, port = 62838

but seems like app not able to build connection with Synergy Server which is running in background

Am not able to replicate this, so either

  1. you can try to run this project from source code, and provide me more info from debug logs

OR

  1. install Deskflow(Previously known as Synergy) app and run that Deskflow server,

In UniControlHub settings, turn off default server now in UniControlHub dashboard, configure SynergyServer (Deskflow )

In Deskflow app, enter client name which you configured in SynergyServer section, then try to connect client with UniControlHub app UniControlHub will try to make connection with Deskflow server if all configured properly

itsandr000 commented 2 weeks ago

I'll try method 2 as I am not sure how to do method 1.

Just a couple of things I've noticed after playing around.

1) I copied adb.exe, AdbWinApi.dll and AdbWinUsbApi.dll to the program directory and was able to get the ADB server running but I still get the socket error. Mind you this is still on my work network so that might be the problem. You might want to update the documentation to mention having to copy these files to the program directory or include them in your next release.

2) When trying to start the server either with AOA I see the socket error come up and text in red that says "LIBUSB_ERROR_PIPE" does that help you in anyway?

For method 2 I can't seem to connect to the Deskflow server on my work network likely due to some firewall restrictions. I'll try next time I have a chance on my home network and I'll let you know,

rohitsangwan01 commented 1 week ago

@itsandr000 if adb is in the path, app should work fine, but ok will check this, Thank you for the info

When trying to start the server either with AOA I see the socket error come up and text in red that says "LIBUSB_ERROR_PIPE" does that help you in anyway?

This should go away if you try to connect again or try to toggle on/off, sometimes android rejects the AOA service, but am planning to replace Libusb with another solution

For method 2 I can't seem to connect to the Deskflow server on my work network likely due to some firewall restrictions. I'll try next time I have a chance on my home network and I'll let you know,

can be the main cause of SocketException, because internally app is also doing the same, it tries to run the deskflow server internally and connect to it, it would be nice to have in documentation if you confirm that it works fine on your home network, or maybe check firewalls,

btw am planning to replace this deskflow dependency with my own solution from scratch, but cant say about deadline