in reply to Re: monitor tcp stream but alert if no info in xx mins
in thread monitor tcp stream but alert if no info in xx mins

little unclear on the syntax for select in this context. can you provide a quickie example? Thanks
  • Comment on Re^2: monitor tcp stream but alert if no info in xx mins

Replies are listed 'Best First'.
Re^3: monitor tcp stream but alert if no info in xx mins
by ikegami (Patriarch) on Jun 29, 2005 at 16:25 UTC
    oh yeah, I forgot how unfriendly it is. There's an class that helps in this case:
    my $sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); my $sel = IO::Select->new($sock); open (FILEOUT, '>', 'output.log'); my @msgstream; while ($sel->can_read($timeout)) { my $line = <$sock>; ... }

    By the way, this thread discusses how to use a second process.