Closed jerry-synap closed 2 months ago
I have no idea, because it should be adb problem. Is that auto disconnect when you using adb directly?
Try the same code using v2.5.2 and the devices will remain connected indefinitely, however, there is no connect-async but a normal connect. I have been trying this for a few hours and I notice most times they all disconnect around 15s.
Is that auto disconnect when you using adb directly?
It works on my device.
deviceMonitor.DeviceConnected += (sender, e) => Console.WriteLine(e);
deviceMonitor.DeviceDisconnected += (sender, e) => Console.WriteLine(e);
deviceMonitor.DeviceChanged += (sender, e) => Console.WriteLine(e);
Yes, I can see no disconnect after 15-30s like mine. Okay, I will dig deeper. WIll post my findings. Thanks for you trying it out and showing me it is local to me.
Okay, I figured out my issue, because I am scanning the IP range from 2-254, and not all IP addresses have a device attached, during the loop, the devices that do respond become connected but the request to the first IP address of say 192.168.1.2 did not have a device attached will eventually respond between 15-18s with a failed to connect message. It is at this point all the devices are disconnected. I have tried connecting to all known "populated" IP addresses and they remain connected. To resolve my issue, I rewrote the scanning method to use "Process.Start" with a timeout of 500ms. It will scan continuously and because the AdbClient did not issue the connect command it ignores/or does not know about this failed response but I can still monitor the devices as they are connecting and disconnecting using the "DeviceMonitor" feature of the library The devices now remain connected. Thanks
Describe the bug
I connect to multiple devices using the code shown. The devices connect and are to be seen via 'adb devices' command, but they all disconnect around 15-30 seconds. I am using the devicemonitor and tracking the disconnects.
Steps to reproduce the bug
Try the following code :
Expected behavior
The devices should stay connected unless the device is unplugged, loses network or is intentionally disconnected.
Screenshots
NuGet package version
3.3.13
.NET Platform
.NET 8
Platform type
Windows
System version
Windows 11 Home , 23H2 OS Version : 22631.3958
IDE
Visual Studio 2022-preview, Visual Studio 2022
Additional context
I am testing the DeviceMonitor feature using a simple console app.