Pinging google repeatedly to check connection

BlitzMax Forums/BlitzMax Programming/Pinging google repeatedly to check connection

BlitzProg(Posted 2013) [#1]
My connection is very unstable at the moment, so when I lose connection I launch a program to check when I'm going to regain it or re-lose it.

basically I'm using a multithreaded program I've created to ping google every 200-300ms for each thread. So like, 10 times a second.

Though it works well, I've been wondering how "reasonable" it is. Would I risk being blocked or anything for doing too many requests, for example?

And if so if there a way to check for internet connection in real time that wouldn't have to produce that many requests?


GfK(Posted 2013) [#2]
Why write a program? Just open a cmd window and type ping www.google.com -t.

That aside, I wouldn't think repeatedly pinging a site would be a very good idea and could be construed as a poor attempt at a DOS attack. If your internet is crap, call your ISP and ask them why.


BlitzProg(Posted 2013) [#3]
Yes, that's why I'm asking. I once wrote another multi-threaded program that would download a file by slicing it into many parts and download each part individually, but I made a mistake and got the main program to enter a loop and cause several thousand (actually, I don't know how many) of threaded requests to be sent at once. That ended up getting myself blocked from my own website I was testing it on. :P

Thanks for the ping trick. I didn't know. (it tends to happen a lot with many tools I create xD)


xlsior(Posted 2013) [#4]
10 times a second seems a bit overzealous to me, especially since half a second response times aren't that unusual with internet traffic if you're far away from a server.


Russell(Posted 2013) [#5]
Actually, 200-300ms is 3 to 5 times a second, not 10 (every 100ms would be 10 times a second).

Anyways, there's a free program out there called "Internet Connection Monitor" (version 1.20 is the latest). It pings the website(s) of your choice every n-seconds (configurable) and does the trick. It's written in java, so it's cross-platform (although you'll need to have the java jre installed on Windows).

I found it to be just what the doctor ordered for my needs.

Russell


GfK(Posted 2013) [#6]
Actually, 200-300ms is 3 to 5 times a second, not 10 (every 100ms would be 10 times a second
i'm sure he's aware of what 1000 divided by 200 is.

He is using multiple threads pinging at 200ms each.


Russell(Posted 2013) [#7]
Just sayin' ;)