bengmau has asked for the wisdom of the Perl Monks concerning the following question:
my $sock; $sock = IO::Socket::INET->new(PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); open (FILEOUT,">output.log"); my @msgstream; while (<$sock>) { #process line until end of socket stream my $line=$_; if ($line=~/^;/) { # if the line has a ';' in it processmsg(\@msgstream); undef @msgstream; #clear @msgstream } else { # add to msgqueue push @msgstream,$line; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: monitor tcp stream but alert if no info in xx mins
by ikegami (Patriarch) on Jun 29, 2005 at 14:53 UTC | |
by bengmau (Beadle) on Jun 29, 2005 at 15:41 UTC | |
by ikegami (Patriarch) on Jun 29, 2005 at 16:25 UTC |