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

Possiblility to connect to remote adb device? #144

Closed
rajdeepv opened this issue May 9, 2018 · 7 comments
Closed

Possiblility to connect to remote adb device? #144

rajdeepv opened this issue May 9, 2018 · 7 comments

Comments

@rajdeepv
Copy link

rajdeepv commented May 9, 2018

We connect to remote adb devices using env variable ADB_SERVER_SOCKET ( same as -L option of adb but using ENV variable instead)
looks like scrcpy does not recognize this. It pushed the file to the remote device and thereafter just stuck. It will be great if that can be supported. Or is there any other way to access the remote device using scrcpy?

@rom1v
Copy link
Collaborator

rom1v commented May 9, 2018

$ adb kill-server
$ adb -P1234 start-server
$ export ADB_SERVER_SOCKET=tcp:localhost:1234
$ scrcpy

It seems to work…

is there any other way to access the remote device using scrcpy?

https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/

@rajdeepv
Copy link
Author

rajdeepv commented May 10, 2018

It works with localhost but not with a remote host.
Here is what I did
On laptop 1

adb kill-server
adb -a -P 5037 nodaemon server >/tmp/adblog 2>&1 &

On laptop 2

export ADB_SERVER_SOCKET=tcp:<ip_of_laptop_1>:5037

check adb devices shows the device

➜  ~ scrcpy 
   
/usr/local/Cellar/scrcpy/1.1_1/share/scrcpy/scrcpy-server.jar: 1 file pushed. 0.4 MB/s (19334 bytes in 0.044s)

And there is no output and no UI after that

@rom1v
Copy link
Collaborator

rom1v commented May 10, 2018

And there is no output and no UI after that

Could you try on current master, please? (see #5 (comment))

@hpsaini
Copy link

hpsaini commented Aug 21, 2018

Even I am not able to see output when I am trying to connect to remote server.
Followed same steps as highlighted by rajdeepv

@hpsaini
Copy link

hpsaini commented Aug 21, 2018

getting below error on remote adb server
adb E 08-21 13:03:40 5790 169951 services.cpp:278] failed to connect to socket 'tcp:27183': Connection refused

@rom1v
Copy link
Collaborator

rom1v commented Aug 21, 2018

failed to connect to socket 'tcp:27183': Connection refused

I just tried and reproduced. In fact, this is "expected": the adb reverse redirects a port between the device and the remote adb, while scrcpy connects to that port locally. This may not work.

You need, in addition, to redirect remote 27183 to local 27183 (which is not related to adb).

Using SSH, you can enable both redirections. From the local computer:

adb kill-server    # kill the local adb server on 5037
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open

From another terminal on the local computer:

scrcpy

@rom1v
Copy link
Collaborator

rom1v commented May 24, 2020

I added a new option --force-adb-forward to avoid a SSH remote port forwarding: 8f46e18

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

No branches or pull requests

3 participants