Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'One way to prevent dropped network connections' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 09:39:45AM
I haven't had that problem with my Airport connection, but it's an irritating problem I've had with Sprint, through my bluetooth phone. I noticed that if I keep it busy, I don't get dropped (as much.) Instead of hassling with the terminal, I wrote an applescript, which I saved as an application named "Ping":

do shell script "ping -i20 xxx.xxx.xxx.xxx &> /dev/null &echo $!"
set pid to the result
tell application "Ping" to deactivate
display dialog (option-return)
  "Pinging xxx.xxx.xxx.xxx every 20 seconds." & return & (option-return)
  "Waiting to kill process ID: " & pid (option-return)
  buttons "OK" default button "OK"
do shell script "kill " & pid
You'll need to replace xxx.xxx.xxx.xxx with a valid IP address or domain reference (if it works for you) outside your intranet a domain name may work too (EG www.macoshints.com.)

[ Reply to This | # ]
xxx.xxx.xxx.xxx
Authored by: chally on Dec 13, '06 09:44:52AM

Obviously, I've been pinging my.yahoo.com...I meant to replace that with the same "xxx.xxx.xxx.xxx" reference as I did in the command.



[ Reply to This | # ]
-i20 is 20 second delay between ping attempts
Authored by: chally on Dec 13, '06 09:46:30AM

By the way, -i20 delays 20 seconds between ping attempts, which is kinder to everyone between you and the server you're pinging, inclusive.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: stutemp1 on Dec 13, '06 10:18:48AM

Be careful of the IP you use! Repeated pings, though minimal in packet size, do add up bandwidth-wise and can be misconstrued as a type of DoS attack. If you pick an address that pays by the bandwidth used, they will not appreciate the added non-productive traffic to their site. Perhaps use an address like the home page of your ISP.... sprint.com or etc. Plus, I like MacOSXhints.com to be speedy. :-)

Personally I use the widget named Geek Image which allows one to load a URL periodically like from a webcam site, or weather radar map etc. it has separate timers for updating when activated and updating in the background, so you can set it to reload the map every 4-5 minutes or whatever it takes to keep the connection alive. This probably uses more bandwidth than a few pings, but will not flag you in security programs as a potential hacker.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 10:39:11AM

Yes, I'm sensitive to this. That's why I use yahoo, and limit the traffic to the minimum necessary (I found -i20s about right.)

...and, sure...the best solution, if you have it, is your own service. I don't know if pinging sprint from sprint will have the desired effect--maybe.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: xianman on Dec 13, '06 03:48:29PM

I would really like to try this script, but I get an error saying 'The variable deactivate is not defined.'. My Script editor is seeing 'deactivate' in the 3rd line as a variable and not a function, as indicated by its green color. Unfortunately I am not saavy enough to know how to fix this problem. Any ideas?



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 04:23:40PM

That's weird. Works for me. Try this: http://tinyurl.com/yfrsqn

Don't forget to change the IP address, and just try commenting out the deactivate line if it doesn't work for you.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: xianman on Dec 13, '06 04:56:58PM

Thanks, that works to comment that line out. Not sure why it works for you and not for me though.



[ Reply to This | # ]
One way to prevent dropped network connections
Authored by: chally on Dec 13, '06 07:04:07PM

Frankly, it *did* work for me (it was in the same place from which I've used it) but it doesn't work now. Something must have changed. Very strange. Maybe applescript applications can no longer understand the deactivate command, or maybe I had something installed that made it understand. I don't know. In any case, it's not entirely necessary. It was helpful when I launched the app from another script, though.

Glad it's working for you now.



[ Reply to This | # ]