I'm porting an Linux C++ application to Android NDK and my app invokes ping
to the shell to see the status of another machine for logging purposes. On my android port this fails for localhost
:
# ping -c 10 localhost
ping: unknown host localhost
If I give another web address that appears to send, but no response is seen:
# ping -c 1 google.com
PING google.com (74.125.239.136) 56(84) bytes of data.
--- google.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
Is localhost
expected to work on Android to refer back to the android itself (not the host machine running the emulator as discussed here)? If not, is there some other way that will work?
Is ping
expected to work on the Android emulator for Mac OSX or must I do something to allow the emulator to see the network fully?