sub Startup { while(ContinueRun($delay)) { $server = IO::Socket::INET->new(LocalPort => $server_port, Type => SOCK_STREAM, Reuse => 1, Listen => 10 ) # or SOMAXCONN or die "Couldn't be a tcp server on port $server_port : $@\n"; while ($client = $server->accept()) { # $client is the new connection $client->autoflush(1); while ( <$client>) { $line=$_; open OUTPUT, ">>$logfile" or die "Cannot open $logfile :$!"; print OUTPUT $line; close OUTPUT; next; } } }