Thread Einfache While-Schleife bis Interverbindung da ist
(7 answers)
Opened by kami at 2010-09-04 14:13 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #!/usr/bin/perl use warnings; use strict; use LWP::Online 'online'; my $start = time(); my $now = 0; my $max = 30; my $conn = 0; while ($now < $max) { if ( online('http') ) { $conn = 1; last; } sleep(1); $now = time() - $start; } die "$max seconds over. No connection. Aborting.\n" unless $conn; |