In your select(), you're waiting for socket to become readable, but SSL communication is not as simple as that, it may require some internal writing in between. Your generic code should be more like this:

if ( $SSL_ERROR == SSL_WANT_READ) { select($rbits,undef,undef,...); sysread... } elsif ( $SSL_ERROR == SSL_WANT_WRITE) { select(undef,$wbits,undef,...); sysread... # YES, sysread! }
I recently played with non-blocking SSL stuff, and both timeout and select work fine for me that way.

OTOH all that stuff is needed only for non-blocking code. If the only thing needed is timeout in blocking code, I'd just use alarm($timeout).


In reply to Re: IO::Socket::SSL's select() ignores pending data by dk
in thread IO::Socket::SSL's select() ignores pending data by ska

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.