I know about
ping -c 1 8.8.8.8
What about a clean and portable way?
I think something like checking syslog
for the last request or asking a network manager when present would be the best route but apart from Android (http://developer.android.com/reference/android/net/ConnectivityManager.html) I couldn't find anything...
I'm working with Python but this code doesn't exist...
import sys
sys.getnetworkstatus() # True when recent succesful connection went through
Any pointers?