USB doesn't provide network to mobile device.
If both your desktop and phone are connected to the same WiFi (or any other local network), then use your desktop IP address assigned by the router (not localhost
and not 127.0.0.1
).
To find out the IP address of your desktop:
ipconfig
(Windows) or ifconfig
(Unix)
ifconfig | grep "inet " | grep -v 127.0.0.1
will yield only the important stufflocalhost
and 127.0.0.1
)If your phone is connected to the mobile network, then things are going to be harder.
Either go hardcore:
<your desktop IP>:<server port number>
Otherwise use something like xip.io or ngrok.
NOTE: The ifconfig
command has been deprecated and thus missing by default on Debian Linux, starting from Debian stretch. The new and recommended alternative for examining a network configuration on Debian Linux is ip command. For example to use ip command to display a network configuration run the following:
ip address
The above ip command can be abbreviated to:
ip a
If you still prefer to use ifconfig
as part of your daily sys admin routine, you can easily install it as part of the net-tools
package.
apt-get install net-tools
Reference is here