I am trying to implement redundancy in a client application that I am writing so that I can have a primary server and a backup server. The client is tailing a logfile and sends results to a server for processing, at the end of the tail loop it sends data to a function that tries to establish a connection to the primary server and send the data, if that fails then the data is sent to the backup (failover) server. The way the function works, if the primary comes back online then it automatically knows and starts sending data back to the primary.
The only problem with the way this is implemented is that every connection remains for a couple of minutes in the TIME_WAIT stage: tcp 0 0 xxx.xxx.xxx.xxx:xxx xxx.xxx.xxx.xxx:xxx TIME_WAIT tcp 0 0 xxx.xxx.xxx.xxx:xxx xxx.xxx.xxx.xxx:xxx TIME_WAIT Which adds up if I am sending several connections per minute or possibly per second. My question is, is there a way to bypass the TIME_WAIT stage or at least reduce the time it is in this stage from within the program? Below is the subroutine and how it is called. If there is another way of doing this please let me know. sub sendData { my $xmlfile = shift; my $client = new IO::Socket::SSL ( PeerAddr => $server, PeerPort => $port, Proto => 'tcp', ReuseAddr => 1 ); print DBLOG "Could't create primary socket: $!\n" unless $client; my $backup = new IO::Socket::SSL ( PeerAddr => $bakserv, PeerPort => $bakport, Proto => 'tcp', ReuseAddr => 1 ) unless $client; if (not defined $client && not defined $backup) { print DBLOG "Couln't create secondary socket: $!\n" unless $backup; } if (defined $client) { print $client $xmlfile; } elsif (defined $backup) { print $backup $xmlfile unless $client; } } sendData($sendXml); Thanks, Josh Berry | CISSP GCIA Information Security 214-765-1296 -------------------------------------------------------------------- If you spend more on coffee than on IT security, you will be hacked. What's more, you deserve to be hacked. -- (Former) White House Cybersecurity adviser Richard Clarke -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>