M2Crypto: select() behaves weird on SSL sockets

Irmen de Jong irmen at NOSPAMREMOVETHISxs4all.nl
Tue Jun 11 17:41:11 EDT 2002

Donn Cave wrote:

> I'm no expert on this, but my theory is that you must call
> SSL_pending(self->ssl) to see if any data remains in its buffer.
> Then only when no data remains, you would call select.

I looked around a bit and oh boy, M2Crypto supplies a "pending"
method on SSL sockets, that apparently returns the remaining data.

I now have a workaround; if my socket is an SSL socket, and
there are still bytes pending (socket.pending()>0), I don't
call select. In all other cases it is 'safe' to call select.

My code (Pyro with SSL and timeouts) now works, I'm happy :-)

Thanks for the help!

Irmen de Jong

More information about the Python-list mailing list