The short answer to the question in your subject is "yes", you have made a
contract with OpenSSL to do so, so you sould fulfill that contract.

> Non-Blocking socket.

> called SSL_write with data (say 'abc123') and socket 'h'.
> Then 'SSL_get_error' found error code SSL_ERROR_WANT_WRITE.

That means that the SSL_write function cannot make forward progress until
the socket becomes writable. You have made a contract to send 'abc123' as
the next six bytes of data, and you cannot change that.

> after some time call to 'select' detected that socket 'h' is
> writable. (Does it mean that data 'abc123' was written successfully ?)

The question is ambiguous. But since you made a contract to send the data
'abc123', you are still required to send it, whether or not OpenSSL actually
needs to get that data from you. (It might need the data, or it might ignore
the next six bytes since it knows they're 'abc123', that's not your
business.)

> Then I have to insert more data (say 'def567'). So before inserting
> this data should I re-insert 'abc123' data too ?

Assuming you set MOVING_WRITE_BUFFER (which you should), you can send any
data you want, but you must repeat the send of 'abc123' (possibly with
additional data at the same time).

Because the return value of SSL_write was not a positive integer, no data
was logically consumed between the application and OpenSSL. So you must
re-send the same data, whether or not OpenSSL actually needs it. (Otherwise,
there would be no way to know what data needed to be sent and what didn't
without a more complex interface.)

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to