AutumnBox icon indicating copy to clipboard operation
AutumnBox copied to clipboard

Advice: use tcp connection communicate with adb.exe instead of directly calling adb.exe

Open 6769 opened this issue 4 years ago • 2 comments

The whole ADB system has three roles,

  1. adb client:on PC or anywhere;
  2. adb server: on PC;
  3. adbd: on android device;

The first time we call adb.exe devices, (here is the adb client) it will launch a daemon process like adb -L tcp:5037 fork-server server --reply-fd 252 in background.(here is the adb server)

The daemon process open a localhost TCP connection listenning on port 5037, and actually, the adb.exe devices command is doing like this:

client:000chost:version
server:OKAY00040027

client:000chost:devices
server:OKAY00189TXXX7	device

Notice:there is a \t in each line of devices results.

so, it's clear now. Send 000chost:devices to localhost:5037, and we could read the result to device list.

For more command,anyone could use wireshark to capture the tcp communication.

6769 avatar Aug 18 '20 03:08 6769

I have tried this way in the past development. Later gave up, and then left an empty folder. https://github.com/zsh2401/AutumnBox/tree/master/src/AutumnBox.Basic.Shared/ManagedAdb/SocketDriven If implemented, it will completely change the way the Autumn Box interacts with ADB

zsh2401 avatar Aug 18 '20 11:08 zsh2401

This repo heyuanjie87/adbd looks helpful for develop a adb TCP client.

nidbCN avatar Sep 21 '21 13:09 nidbCN