gnirehtet icon indicating copy to clipboard operation
gnirehtet copied to clipboard

how to connect to host computer from android device

Open robert-elles opened this issue 9 months ago • 1 comments

After successful reverse proxy start the android tablet can access the host computers internet. So far so good. But how can the android tablet connect to a port on the host. For example on the host i have a vnc server running. On the android tablet I want to connect to that vnc server on the host. I try pinging the host but I am not even sure which ip address to ping. How can the android tablet see the host in the network?

robert-elles avatar Mar 11 '25 14:03 robert-elles

Solution 1: Use adb reverse (for local ports) If your host is running a local server on a specific port (e.g. VNC on port 5901, web server on 8080), you can forward that port using ADB.

Example for VNC: adb reverse tcp:5901 tcp:5901 This tells Android: “When you try to access localhost:5901, redirect it to host:5901.”

Then, on your Android VNC app:

Connect to: localhost:5901

Works for: Web servers

VNC

Local dev ports (Node, Flask, etc.)

Solution 2: Expose a Local IP Route (More Advanced) To make Android see your host as an IP (e.g. 192.168.100.1):

🪜 Steps: Find your PC's gnirehtet IP gateway:

On your PC, run:

ipconfig (Windows) ifconfig / ip a (Linux/macOS) Look for the gnirehtet or tun adapter. It will show something like 192.168.232.2

On Android:

Try pinging that IP:

ping 192.168.232.2 Or use a port scanner app to test that IP.

Try your VNC app:

Connect to: 192.168.232.2:5901

This may not work reliably because Android can’t always route to the host's VPN-side IP — hence…

Solution 3: Run Host Services on 127.0.0.1 and Use adb reverse For most stable result, use:

adb reverse tcp: tcp: Then connect to localhost: in your Android app.

Final Tip If you always use specific ports, you can script this:

adb reverse tcp:5901 tcp:5901 adb reverse tcp:8080 tcp:8080 adb reverse tcp:5000 tcp:5000 Run it every time after connecting the device.

VaradGupta23 avatar Jul 04 '25 05:07 VaradGupta23