IO-Socket-SSL - Re: accept() blocks until ssl session is started

Posted on Wed May 11 10:21:03 2005 by martinw in response to 433 (See the whole thread of 2)
Re: accept() blocks until ssl session is started
Hi *, Peter Behroozi gave me the tip to solve the problem (Thanks, Peter!).
The inital Socket must be opened as an INET socket like:
my $socket = IO::Socket::INET->new( LocalPort => $port, Listen => 10, Reuse => 1 ) or die "Cannot open socket: $!";
The SSL session than starts after the fork command:
while (my $c = $socket->accept) { print "ACCEPT\n"; my $pid = fork(); defined $pid || die "Cannot fork: $!"; next if $pid; IO::Socket::SSL->start_SSL($c, SSL_key_file => '/home/martin/test.key', SSL_cert_file => '/home/martin/test.crt', SSL_use_cert => 1, SSL_server => 1, SSL_cipher_list => 'ALL', ); ...
Now, the daemon will not block after a connect from client without doing the SSL handshake. Regards,
martin!
Write a response