There is no good way to do this other than trying to connect to a robust, well-known internet site such as google or yahoo!
You can check programmatically whether an interface is up, but that will still not tell you if you are connected to the internet or just a LAN, as you have found.
|