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 22 23 #!/usr/bin/perl use warnings; use strict; use LWP::Online 'online'; my $start = time(); my $now = time() - $start; my $conn = 0; while (1) { if ( online('http') ) { $conn = 1; last; } sleep(1); $now = time() - $start; if ($now > 30) { print "30 seconds over. No connection. Aborting.\n"; last; } } time() liefert die Sekunden seit Epoch (1.1.1970). |