in reply to (jcwren) Re: Detecting dial-up connections
in thread Detecting dial-up connections

I'm trying to determine if the link is up and running before I try and retrieve something. The idea is that the script spends most of its time asleep and wakes up every x minutes. If it can see a connection it goes and gets something (actually some weather data from a local airport) otherwise it sleeps again.

Replies are listed 'Best First'.
RE: RE: Re: Detecting dial-up connections
by cleen (Pilgrim) on Jun 11, 2000 at 07:12 UTC
    have you tried somthing like
    $minuits_to_wait = '5'; $last = my $last2 = 0; while (1) { if ((time - $last) > 60 * $minuits_to_wait ) { $ret = sometypeof-ping-routine(); if ($ret eq '1') { get_somthing(); } elsif ($ret eq '0') { print "Not connected\n"; } } sleep(60 * $minuits_to_wait); }