How do I tell if I am currently connected to the internet?

The answer to this question is that there is no answer. What does "connected" to the internet mean, anyway? Connected to where? You might be connected to somewhere on the network - but if a gateway somewhere goes down then you're not connected to somewhere else on the network. We could go on and on for hours with this. It's a nasty problem.

In general, I think the best and probably most commonly used method is to first attempt a connection to wherever it is your application will be connecting to. If you succeed - you're connected. If you do not succeed...this tells you only that you cannot connect to this particular server. The server may be down or your network may be down - which you can check with a simple ping. If you are unable to connect and you are unable to ping, I think its pretty safe to assume you are not connected.

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.