Scrcpy: Possiblility to connect to remote adb device?

Created on 9 May 2018  Â·  7Comments  Â·  Source: Genymobile/scrcpy

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?

adb question tunnel

Most helpful comment

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

All 7 comments

$ 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/

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

And there is no output and no UI after that

Could you try on current master, please? (see https://github.com/Genymobile/scrcpy/issues/5#issuecomment-373721710)

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tonypachino picture tonypachino  Â·  3Comments

cordac1 picture cordac1  Â·  4Comments

targor picture targor  Â·  3Comments

fleytman picture fleytman  Â·  4Comments

cutoseo picture cutoseo  Â·  4Comments