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

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

Open
6769 opened this issue Aug 18, 2020 · 2 comments

Comments

@6769
Copy link

6769 commented Aug 18, 2020

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.

@zsh2401
Copy link
Owner

zsh2401 commented Aug 18, 2020

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

@nidbCN
Copy link

nidbCN commented Sep 21, 2021

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

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

No branches or pull requests

3 participants