Check internet exists using win32
-
Hi all. I need a function to check whether internet connection exists on a local machine. There is a Wininet api for it but apparently, it is not full proof. There are cases it does not give correct answer. If I use a function to connect to certain url to check whether internet exists, it is also very slow and often freeze the hosting apps. Anyone know how to detect internet connection with a good response (QUICK)? or anyone has implemented a code for it already and willing to share?
-
Hi all. I need a function to check whether internet connection exists on a local machine. There is a Wininet api for it but apparently, it is not full proof. There are cases it does not give correct answer. If I use a function to connect to certain url to check whether internet exists, it is also very slow and often freeze the hosting apps. Anyone know how to detect internet connection with a good response (QUICK)? or anyone has implemented a code for it already and willing to share?
Hello, the codegurus around the world.;) First of all, I can't share this code since this code is my company property. One way is to use NON-BLOCKING socket. 1) Get the source code the raw socket of ping code from MSDN sample. 2) Use the NON-BLOCKING socket (this prevents the program from hanging.) 3) Find DNS of LAN and ping to the couple of URL. Acutually, WinInet class isn't as powerful tool as we think. I guess that this uses BLOCKING socket, so we have to write our own class...:(( We may also use thread with BLOKCING socket (WinInet). So,this may prevent the application hanging. Also, the response speed is an issue. As long as we use LAN, DNS detection is enough, and fast. But, without LAN, and ISP connection, we only use something like URL. Anyway, good luck. :rolleyes: Have a nice day! -Masaaki Onishi-
-
Hello, the codegurus around the world.;) First of all, I can't share this code since this code is my company property. One way is to use NON-BLOCKING socket. 1) Get the source code the raw socket of ping code from MSDN sample. 2) Use the NON-BLOCKING socket (this prevents the program from hanging.) 3) Find DNS of LAN and ping to the couple of URL. Acutually, WinInet class isn't as powerful tool as we think. I guess that this uses BLOCKING socket, so we have to write our own class...:(( We may also use thread with BLOKCING socket (WinInet). So,this may prevent the application hanging. Also, the response speed is an issue. As long as we use LAN, DNS detection is enough, and fast. But, without LAN, and ISP connection, we only use something like URL. Anyway, good luck. :rolleyes: Have a nice day! -Masaaki Onishi-
Hi. Thanks for the answer. However, using ping is not very good idea because a site might block the request. Hence, there is always a request time out. Any other method that I could use? Thanks Hendrik
-
Hi. Thanks for the answer. However, using ping is not very good idea because a site might block the request. Hence, there is always a request time out. Any other method that I could use? Thanks Hendrik
Hello, the codegurus around the world. So, I told that the application pings to a couple of URL. In fact, www.cnn.com didn't work for the ping. CNN web site adds some functionality to take off ping command from the router? If at least of one URL among 100 URLs works, this measn the local computer connects Internet.:eek: We don't need all 100 URL information, so if 5th URL works,just skip 95 URLs. Good Luck :rose: Have a nice day! -Masaaki Onishi-
-
Hello, the codegurus around the world. So, I told that the application pings to a couple of URL. In fact, www.cnn.com didn't work for the ping. CNN web site adds some functionality to take off ping command from the router? If at least of one URL among 100 URLs works, this measn the local computer connects Internet.:eek: We don't need all 100 URL information, so if 5th URL works,just skip 95 URLs. Good Luck :rose: Have a nice day! -Masaaki Onishi-
why not ping codeproject.com ;P
-
why not ping codeproject.com ;P
Hello, the codegurus around the world.;) Basically, I don't want to make Codeproject website slow....:(( We should avoid DOS (Denial Of Service) ? to Codeproject web site. Even though Codeguru web site responses fast, Codeproject responses too slow. I hope that Codeproject web site uses mutli-cast host for this web site.:rolleyes: Have a nice day! -Masaaki Onishi-