LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to tell if computer is connected to Internet?

Hello
I'm using cURL to execute various .php scripts on web servers. I now need to deal with the cse where the user is not connected. How can I detect this?
Thank you
John Brohan
0 Kudos
Message 1 of 8
(7,296 Views)
You could do a simple ping against the web server.
0 Kudos
Message 2 of 8
(7,292 Views)
Thanks Mercurio
The Ping is certainly a start. Presumeably different OS will have different text in the ping results. Is there any way to interpret these results in a corss Windows versions and cross human languages?
Thanks
Yours SIncerely
John
0 Kudos
Message 3 of 8
(7,276 Views)
I can certainly tell you that different OSes behave different with respect to issuing the command-line ping command. On Windows it send out 4 pings. On Unix it keeps pinging until you press Control-C. Since you want something that's cross-platform, then sending a ping command isn't the way to do it. Also, since you're looking for something that's cross-platform your best bet is to do it with the built-in TCP/IP functions. Unless you go with the Internet Toolkit (or whatever its name is now), as that may have something in it, but you have to buy that.

Keep in mind that the TCP Open Connection will give you an error if it can't make a connection, so you can use that to indicate whether you have connectivity to the web server. It's not the same as telling you whether you're "generally" connected to the internet, but that shouldn't matter since it's connection to the web server that you need.

If you want to perform a quick check to, say, have your program behave differently if you can see the web server. So, you could try something as simple as this:

Message Edited by smercurio_fc on 06-07-2007 11:44 AM

Message 4 of 8
(7,267 Views)
Perfect
Works like a charm
John
0 Kudos
Message 5 of 8
(7,254 Views)
Why Port 80?
0 Kudos
Message 6 of 8
(6,453 Views)
That is the HTTP port.
Message 7 of 8
(6,436 Views)

Thanks.

0 Kudos
Message 8 of 8
(6,433 Views)