I am writing a perl script for communicating with android GCM CCS. My script looks like the below:
use IO::Socket::SSL; my $client = IO::Socket::SSL->new('gcm.googleapis.com:5236') or die "error=$!, ssl_error=$SSL_ERROR"; print $client '<stream:stream to="gcm.googleapis.com" version="1.0" #xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" +/>'; print <$client>; print $client '<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">MTI2MjAwMzQ3OTMzQHByb2plY3RzL +mdjbS5hb mFTeUIzcmNaTmtmbnFLZEZiOW1oekNCaVlwT1JEQTJKV1d0dw==</auth>'; if(!<$client>){ print "Auth error\n"; } else { print <$client>; }
After writing the first request on the socket I get response as expected from google server. And I cant print the server response using print But, I dont get any response after writing the second request. It seems like the connection gets closed after the first request and response or something. How do I send multiple request through open TLS connection and receive server responses ?

In reply to Perl IO::Socket::SSL persistent TCP connection by kamrul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.