Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I want to use a TCP service running on my phone that needs its current IP to be known. So when the phone is connected to its internet as alone, I can know its IP.

However to speed up this task, I need to make a local network connection with my phone and know its local IP.

The USB/Wi-Fi tethering by phone with PC does all that along with sharing its internet connection, however in this scenario, I don't want its internet. I am already connected with LAN on my PC. and have no internet plan on my phone.

Any suggestion?

share|improve this question
    
Do a cat /proc/net/dev in adb shell, the first column is the interface name. The do ifconfig ifname, it will show you the ip address. –  ott-- Nov 28 '12 at 11:56
add comment

2 Answers

  1. Connect it to WiFi or ethernet via cable.
  2. At router or DHCP server settings reserve IP address for Android.

Now you has network and known IP address for your Android device.

P.S. if you don't have router and directly connected to internet via cable - you can emulate WiFi router on your PC (not all adapters supported).

share|improve this answer
add comment

If you just want you local IP Address. Then go to terminal emulator and type netcfg. You will see list of interfaces with their IP Addresses (if they are UP).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.