> Oh I see, I used wrong function. All I want is to know if I have
> in buffer some another data to read. In final step I want to have
> client that have e.g. 10 connections to several servers. I want
> to guard with function select() the file descriptors. And when
> select() awakes my thread i want to read the server massage. But
> when I`m reading, it might be possibly, that another server send
> data. So I want to scan buffers for all conection, if there are
> another data to read. I thought that this is possible with the
> function BIO_pending()

You are trying to make bricks without straw. If you want non-blocking
behavior, you must use non-blocking sockets and non-blocking socket
operations. In that case, OpenSSL will tell you what it needs in order to
make further progress, and you can retry an operation when something
changges.

> So now I have another Question. Is there any function that says
> me if there are another data in buffer to read. Or I must try to
> read from all connections before I use the select() function again??

You are thinking about this completely backwards. You should only refuse to
try further operations until 'select' tells you to if you *know* that what
is needed is data to be received from the peer. Otherwise, you should assume
the operation will succeed.

So call SSL_read and if it returns 'WANT_READ', don't try calling SSL_read
again until something changes (such as data being received on the socket or
a subsuent SSL_write succeeding). But if it returns success, by all means
call SSL_read again. Immediately if you want.

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to