xarex has asked for the wisdom of the Perl Monks concerning the following question:
while(my $connection = $server->accept){ my $name = $connection->peerhost; my $port = $connection->peerport; if (my $pid = fork){ close $connection; next; # on to the next connection }else{ # child process - handle connection print $connection "You're connected to the server!\n"; while (<$connection>){ use HTTP::Date; my ($date, $time) = split(" ", HTTP::Date::time2iso()); my ($hour, $min) = split(":", $time); open (my $log, '+>>',"../../home/freetrac/public_html/logs/$po +rt $date.txt") || die "Couldn't open log.txt: $!"; print $log $_; close $log; exit(0); } $connection->shutdown(SHUT_RDWR); exit; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: socket time out
by oha (Friar) on Nov 09, 2007 at 15:27 UTC | |
by xarex (Initiate) on Nov 09, 2007 at 16:08 UTC | |
by Anonymous Monk on Jan 04, 2008 at 11:24 UTC | |
|
Re: socket time out
by weismat (Friar) on Nov 09, 2007 at 17:09 UTC |