Hello,
>   Pardon me, I think I'm a little thick today.  I get what you're 
> all saying but I'm still not 100% sure of how this should be applied.
> Here's the program flow, without SSL:
> 
> while(!quit) {
>   for(i in all file descriptors) {
>     if(we have something buffered up to say to the server)
>         FD_SET(thisfd, &writefds)
>     /* we are always interested in what the server has to say
>        * to us */
>       FD_SET(thisfd, &readfds);
>   }
> 
>   select(maxfd + 1, &readfds, &writefds, NULL, timeout);
> 
>   if(FD_ISSET(thisfd, &readfds)) {
>     read(thisfd), process it, probably send a reply with write()
>   } else if(FD_ISSET(thisfd, &writefds) {
>     write(thisfd) whatever we have buffered up; if it was a partial
>       write, update the buffer.
>   }
> }
> 
>   Using SSL, how should this look? From what I'm hearing, it shouldn't
> use select() at all.  So how do I find out if the server has something
> to say short of polling it with SSL_read?
You may use select() but with some care.
Simplest way is to:
 1) wait on select()
 2) read hit from SSL descriptor occur
 3) read incrementally with SSL_read() from that descriptor until
WANT_READ
   (or in other words - get all data from SSL read buffer)
 4) go to select()

In 3) you may get WANT_WRITE too, in this case you should go to select()
and wait for write hit on SSL descriptor and perform 3) as you
do when you get read hit in select() on this SSL descriptor.

Best regards,
-- 
Marek Marcola <[EMAIL PROTECTED]>

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

Reply via email to