hallikpapa has asked for the wisdom of the Perl Monks concerning the following question:
When the connection is made, it justCONNECT: $socket = IO::Socket::INET->new("$host:$port"); unless ($socket) { # Potential Problem here $retry++; if ( $retry == 3 ) { log_die("Client : Error connecting to server ... $@\n"); } log_notice("Client : Retry $retry : Sleeping $timeout Seconds\n") +; sleep($timeout); # wait a minute; goto CONNECT; } $retry = 0; #Reset in case we disconnect early $connected = 1; #So that we know...
And starts streaming the live data to the client machine for other fun stuff. The reason it connects to two and tails them is one is primary, and one is failover. So live data will only write to one server at a time. This doesn't seem very efficient to me, and seeking any wisdom from the monks on how I may combine this process into one script that can tell which server is being written to, or even a module that handles situations like this flawlessy! Thanks for any pointers / suggestions.print $socket "tail\n"; # Rock n Roll
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tailing two files at once through IO::Socket
by cLive ;-) (Prior) on Jan 03, 2008 at 08:03 UTC |