Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.78k stars 10.47k forks source link

using raw TCP/UDP sockets with a relay server without ADB #2336

Open a0ab1d3564 opened 3 years ago

a0ab1d3564 commented 3 years ago

First of all let me thank everyone working on this project, it's Amazing! I have a question I hope it's not repeated, is it possible to use a raw TCP/UDP sockets instead of relying on ADB?

From what I've understood in https://github.com/Genymobile/scrcpy/blob/master/DEVELOP.md: 1- scrcpy-server is moved to the device using ADB to get AID_SHELL which has some privileges scrcpy-server needed to work. 2- ADB is used to establish a connection between the scrcpy-server and scrcpy-client.

If it's possible to add scrcpy-server with the same privileges to the device as core service or init.d service with the same privileges using custom ROM or rooted device with Magisk module, can we change the connection from ADB to a custom made server which use raw TCP/UDP sockets to communicate between scrcpy-server and scrcpy-client?

What I'm thinking about is to make scrcpy-server connect to the custom server and scrcpy-client connect to the same server, and the server act as a relay without ADB involvement.

I just want to know if that a possible and where I can start to change the communication layer to remove ADB involvement.

A better Idea

Can we abstract the communication layer between scrcpy-server and scrcpy-client which will make it easy to impalement different ways for transfer data in the network for example: (Wifi Direct) #839, (Bluetooth) #2335, (Websockers) #313 or even using USB Tethering (without ADB), or to solve some requests like #100.

a0ab1d3564 commented 3 years ago

TL;TR

Can we replace the communication layer from ADB sockets to anything else? assuming we can keep scrcpy-server running on the device with all AID_SHELL privileges?

yume-chan commented 2 years ago

Can we replace the communication layer from ADB sockets to anything else?

Yes, by replacing here with a normal socket (and somehow tell it where to connect)

https://github.com/Genymobile/scrcpy/blob/5031b2c8ff4285a43ca445f53adaaa7fe635d06f/server/src/main/java/com/genymobile/scrcpy/DesktopConnection.java#L38-L42

calllivecn commented 1 month ago

Is there any progress at this time?