Wednesday, 15 January 2014

android - How to get hostname like from ping -a command? -



android - How to get hostname like from ping -a command? -

when utilize ping -a 192.168.1.15, get:

pinging border [192.168.1.15] 32 bytes of data: ...

but when using inetaddress.gethostname(), getting:

hostname is: 192.168.1.15

why that, how edge instead of ip address?

ps. getcanonicalhostname() returns ip address well.

this because not dns name, netbios name... possible ip address? how?

you can seek using next code , see if works.

inetaddress host = inetaddress.getbyname("192.168.1.15"); system.out.println(host.gethostname());

android

No comments:

Post a Comment