Hi all,

I'm attempting to do a very simple Net::Server listening on two different
ports, one being TCP and one being SSLEAY.  So far this is working, but as
soon as I make an normal unencrypted connection (telnet) to the SSLEAY port
and *disconnect*, the Net::Server goes into an infinite loop, passing
process_request() over and over.  This only happens when the non-encrypted
client (telnet), disconnects from the encrypted socket - testing with
openssl s_client, it does work as expected and disconnects / closes the
fork.

STDERR returns Received [] until the Net::Server is forcefully killed.  It's
as if Net::Server doesn't detect that the client has disconnected (which is
more than likely precisely what it is).

Relavent code bits:

sub process_request {
  my $self = shift;
  eval {
    local $SIG{ALRM} = sub { die "Timed Out!\n"; };
    my $timeout = 30;
    my $previous_alarm = alarm($timeout);
    while (<STDIN>) {
      s/\r?\n$//;
      print STDERR "Received [$_]\n";
      print "$_\n";
      last if /quit/i;
      alarm($timeout);
    }
    alarm($previous_alarm);
  };

  if ($@=~/timed out/i) {
    print STDERR "Timed out.\n";
    return;
  }
}

Server->run(port              => ["2020/tcp", "2021/ssleay"],       # The
TCP port that we are listening on
                setsid            => "0",                               #
Run the application in the background
                SSL_key_file      => "/home/cknipe/src/server.key",      #
SSL Private Key
                SSL_cert_file     => "/home/cknipe/src/server.crt",      #
SSL Public Certificate
);

Would appreciate it if anyone can perhaps shed some light for me.

Thanks,
Chris.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to