diff options
Diffstat (limited to 'perl/bio.pl')
-rw-r--r-- | perl/bio.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/perl/bio.pl b/perl/bio.pl new file mode 100644 index 0000000000..be27581c02 --- /dev/null +++ b/perl/bio.pl @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +use ExtUtils::testlib; + +use SSLeay; + +$cmd=<<"EOF"; + +EOF + +$conn="localhost:4433"; +$conn=$ARGV[0] if $#ARGV >= 0; +$bio=SSLeay::BIO::new("connect"); +$bio->set_callback(sub {print STDERR $_[0]->number_read."\n"; $_[$#_] }); +$bio->hostname($conn) || die $ssl->error(); + + +(($ret=$bio->do_handshake()) > 0) || die $bio->error(); + +(($ret=$bio->syswrite($cmd)) > 0) || die $bio->error(); + +while (1) + { + $ret=$bio->sysread($buf,10240); + last if ($ret <= 0); + print $buf; + } + |