How do I test if connected to the Internernet?
BlitzPlus Forums/BlitzPlus Programming/How do I test if connected to the Internernet?
| ||
How can I test if the computer is connected to the internet in Blitz Basic? It has to be very simple, but I can't find a way. I just need a function that will return 0 if not connected or 1 if connected online. |
| ||
Since nobody is helping me with this... this is what I figured so far: I made a ping.bat file with the following line: ping.exe www.yahoo.com>ping.txt Then I open the text file from my Blitz program and I read the results. The only problem with this one is that the *.bat file takes several seconds to generate the result, so I have to stop my process in my program until the ping.txt is generated. It is not perfect, but it works :-) |
| ||
if opentcpstream("www.yahoo.com") then alert("we have the internet") else alert("no internet") |
| ||
InternetGetConnectedState is a Windows API function you can use, with a suitable declaration file. Try doing some site and internet searches on it for more info. |