#
# a test server for testing Net::SSL-class's behavior
# (aspa@hip.fi).
#
# $Id: ssl_server.pl,v 1.1 1999/05/27 08:39:43 aspa Exp aspa $.
#

use Net::SSL;

if(!($sock = Net::SSL->new( Listen => 5,
			    LocalAddr => 'localhost',
			    LocalPort => 9000,
			    Proto     => 'tcp')) ) {
  print STDERR "unable to create socket: $!.\n";
  exit(0);
}

print STDERR "socket created.\n";

while(($s = $sock->accept)) {

  if( ! $s ) {
    print STDERR "error: '$!'.\n";
    next;
  }

  print STDERR "connection opened.\n";
  $date = `date`; chop $date;
  $str = "my date command says it's: '$date'.\n";
  $s->write($str, length($str));
  $s->close();
  print STDERR "connection closed.\n";

}

$sock->close();

print STDERR "loop exited.\n";
