Thank you for your advice.
Now, it got almost clear!

> Writing:
>
> 1) Acquire the mutex.
>
> 2) Call SSL_write. If we have sent all of the data, release the lock and
> returen.
>
> 3) If we sent any data, re-adjust to only send the data that remains and
go
> to step 2.
>
> 4) If we got a zero, release the lock and return the number of bytes
> successfully sent.
>
> 5) If we got an error, pass the return value to SSL_get_error.
>
> 6) If the error is fatal error, release the lock and return.
>
> 7) Obey the WANT_READ or WANT_WRITE by releasing the lock, calling
'select',
> and re-acquiring the lock. Go back to step 2.

I have looked into s_client example, and thought over your advice, but I
have one more doubt yet.
I think, the meaning of "ready for write" at select() is only "there is some
space to write on TCP stack". Actually, the result of select() is almost
always "ready for write".
So, the meanings of WANT_READ and WANT_WRITE are really same as buffer full
on TCP stack? If not so, I think there is a possibility to cause non-wait
loop at step 2-7.

Sorry for I'm poor on the uptake...

--
YAMANEKO / Mao
http://yamamaya.com/
http://wiki.livedoor.jp/yamamaya_com/

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

Reply via email to