Reuse a Perl IO::socket::ssl client -



Reuse a Perl IO::socket::ssl client -

i'm trying lighten part of code user lwp::ua acces rest api using ssl layer. i'm trying accomplish same result bare io::socket::ssl module. work great on first phone call :

$sslsocket = io::socket::ssl->new( peerhost => $server, peerport => "https"); print $sslsocket "get /restapi/json/v1/resources?authtoken=$token http/1.0\r\n\r\n"; while(<$sslsocket>){ $response = $_; } $resources = $json->decode($response);

but when i'm trying reuse socket i'm getting no awnser

my $sslsocket = io::socket::ssl->new( peerhost => $server, peerport => "https"); print $sslsocket "get /restapi/json/v1/resources?authtoken=$token http/1.0\r\n\r\n"; while(<$sslsocket>){ $response = $_; } $resources = $json->decode($response); print $sslsocket ,"get /restapi/json/v1/resources/3138/accounts?authtoken=$token http/1.0\r\n\r\n"; while(<$sslsocket >){ $response = $_; } close($sslsocket ); $accounts = $json->decode($response);

the sec read empty. since cannot utilize recv or send method i'm bit lost. there way not open new ssl socket on each request ? give thanks you answers.

perl sockets ssl

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -