Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.53k stars 10.45k forks source link

How to connect through TCP/IP address? #1695

Open Powherful opened 4 years ago

Powherful commented 4 years ago

I don't have the same issue that OP is having (I'm only ever connecting to two devices, my phone and my tablet), but +1 to this idea. It would just be a nice small time-saving feature to have, being able to type something like scrcpy -t 1 instead of scrcpy -s 192.168.1.6:5555.

Originally posted by @richbordoni in https://github.com/Genymobile/scrcpy/issues/1148#issuecomment-615497797

I tried this method didn't workout for me. Can you show some light towards this problem I am facing.

MY OUTPUT:

Z:\andriod_to_pc_screensharing\scrcpy-win64-v1.16>scrcpy -s 192.168.225.58:5555 INFO: scrcpy 1.16 https://github.com/Genymobile/scrcpy adb: error: failed to get feature set: device '192.168.225.58:5555' not found ERROR: "adb push" returned with value 1 Press any key to continue...

rom1v commented 4 years ago
adb: error: failed to get feature set: device '192.168.225.58:5555' not found

It's just that your device is not detected/connected (i.e. it does not show up in adb devices).

Did you adb connect 192.168.225.58:5555?

https://github.com/Genymobile/scrcpy#wireless

Powherful commented 4 years ago
adb: error: failed to get feature set: device '192.168.225.58:5555' not found

It's just that your device is not detected/connected (i.e. it does not show up in adb devices).

Did you adb connect 192.168.225.58:5555?

https://github.com/Genymobile/scrcpy#wireless

It shows connected Yet shows the same output

rom1v commented 4 years ago

What is the result of

adb -s 192.168.225.58:5555 shell echo it works

?

sdnazers20 commented 4 years ago

Hi

@rom1v I am able connect my mobile device using local network and able to mirror the screen, however I want to know if i can connect to my mobile using mobile network (3G/4G) by opening any port or so.... Please advice or provide a link to the solution

rom1v commented 4 years ago

however I want to know if i can connect to my mobile using mobile network (3G/4G) by opening any port or so

No, you can't connect directly, because mobile networks typically do not allow to connect to your device from the internet (you can't "open a port on your NAT").

sdnazers20 commented 4 years ago

however I want to know if i can connect to my mobile using mobile network (3G/4G) by opening any port or so

No, you can't connect directly, because mobile networks typically do not allow to connect to your device from the internet (you can't "open a port on your NAT").

@rom1v Can you suggest me any other way to accomplish this basically i am trying yo mirror the screen over 3G/4G connection....your suggestion means a lot please advice

igolf-plat commented 3 years ago

however I want to know if i can connect to my mobile using mobile network (3G/4G) by opening any port or so

No, you can't connect directly, because mobile networks typically do not allow to connect to your device from the internet (you can't "open a port on your NAT").

@rom1v Can you suggest me any other way to accomplish this basically i am trying yo mirror the screen over 3G/4G connection....your suggestion means a lot please advice

@sdnazers20 I'm doing the same thing. Basically you have to have a server with public IP to forward the data. And I've succeeded in connecting to ssh server running on the device behind nat, but when I change the to-be-forwarded port 22 to 5555, I fail in adb connect x.x.x.x:5555

still struggle in reading adbd source code.

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented 3 years ago

I created this tool to ease wireless connectivity. Check it out and let me know of your experience.

https://github.com/fusionneur/ethernally

obenitez01 commented 2 years ago

sin embargo, quiero saber si puedo conectarme a mi móvil usando la red móvil (3G / 4G) abriendo cualquier puerto o algo así

No, no puede conectarse directamente, porque las redes móviles normalmente no permiten conectarse a su dispositivo desde Internet (no puede "abrir un puerto en su NAT").

@ rom1v ¿Puedes sugerirme alguna otra forma de lograr esto? Básicamente estoy tratando de reflejar la pantalla a través de una conexión 3G / 4G ... tu sugerencia significa mucho por favor consejo

@ sdnazers20 Estoy haciendo lo mismo. Básicamente tienes que tener un servidor con IP pública para reenviar los datos. Y logré conectarme al servidor ssh que se ejecuta en el dispositivo detrás de nat, pero cuando cambio el puerto 22 a reenviar a 5555, fallo enadb connect x.x.x.x:5555

Todavía tengo problemas para leer el código fuente de ADBD.

I'm looking for a way to do the same, @igolf-plat still couldn't figure it out? If you've already figured it out, it would be great to know how you did it.

ncdejito commented 2 years ago

however I want to know if i can connect to my mobile using mobile network (3G/4G) by opening any port or so

was able to make it work with ngrok!

proof

Documented my steps here. Idea is to open a tunnel then run:

adb connect 123.tcp.ngrok.io:123456
scrcpy
girng commented 1 year ago

was having an issue of adb not showing devices, even after i installed those drivers.

this little batch script worked for me

adb connect 10.0.0.122:42625
scrcpy
@pause

click on "Wireless debugging" in settings and put in your ip:port. works great now!! hope this helps

msk-nightly commented 3 months ago

I have Wireless Debugging enabled on my android device and have even successfully paired the device to my computer (running Win 10 x64) using adb and a pairing code found under the Wireless Debugging option. I am still unable to connect. (On a possible related note: I did notice an option in adb to check mdns services which I don't have.)