From: Brian Modra Date: 2013-01-31T04:52:06+09:00 Subject: Re: SSLSocket in non-blocking mode I've done some more work on this since posting, and tested out an idea I hinted at in my previous post: I check the underlying tcpsocket (@sock in my code) using IO.select. (Actually I call select passing it an array of the currently connected tcp sockets, and if there are any bytes waiting, then if I call sysread on the SSLSocket, it will fill its input buffer from the tcpsocket, decrypt them, and return them. So I guess I answered my own question. Also, it seems logical to me now that #pending will actually only tell me how many bytes are remaining in the output buffer of the SLSocket, because the SSLSocket won't read from the tcpsocket unless its buffer is -empty-. I.e. when #pending is returning zero :) So I have to be optimistic, read one byte (only when I know, from the call to IO.select, that there are bytes ready for it to process)... which will trigger it to read from the TCPSocket, and decrypt it, and fill its output buffer, and then #pending will be non zero. I'm making assumptions here, and would be grateful if someone can provide an authoritative answer. -- Posted via http://www.ruby-forum.com/.