⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssl_write.pod

📁 开源的ssl算法openssl,版本0.9.8H
💻 POD
字号:
=pod=head1 NAMESSL_write - write bytes to a TLS/SSL connection.=head1 SYNOPSIS #include <openssl/ssl.h> int SSL_write(SSL *ssl, const void *buf, int num);=head1 DESCRIPTIONSSL_write() writes B<num> bytes from the buffer B<buf> into the specifiedB<ssl> connection.=head1 NOTESIf necessary, SSL_write() will negotiate a TLS/SSL session, ifnot already explicitly performed by L<SSL_connect(3)|SSL_connect(3)> orL<SSL_accept(3)|SSL_accept(3)>. If thepeer requests a re-negotiation, it will be performed transparently duringthe SSL_write() operation. The behaviour of SSL_write() depends on theunderlying BIO. For the transparent negotiation to succeed, the B<ssl> must have beeninitialized to client or server mode. This is being done by callingL<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state()before the first call to an L<SSL_read(3)|SSL_read(3)> or SSL_write() function.If the underlying BIO is B<blocking>, SSL_write() will only return, once thewrite operation has been finished or an error occurred, except when arenegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of theL<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call.If the underlying BIO is B<non-blocking>, SSL_write() will also return,when the underlying BIO could not satisfy the needs of SSL_write()to continue the operation. In this case a call toL<SSL_get_error(3)|SSL_get_error(3)> with thereturn value of SSL_write() will yield B<SSL_ERROR_WANT_READ> orB<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, acall to SSL_write() can also cause read operations! The calling processthen must repeat the call after taking appropriate action to satisfy theneeds of SSL_write(). The action depends on the underlying BIO. When using anon-blocking socket, nothing is to be done, but select() can be used to checkfor the required condition. When using a buffering BIO, like a BIO pair, datamust be written into or retrieved out of the BIO before being able to continue.SSL_write() will only return with success, when the complete contentsof B<buf> of length B<num> has been written. This default behaviourcan be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option ofL<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>. When this flag is set,SSL_write() will also return with success, when a partial write has beensuccessfully completed. In this case the SSL_write() operation is consideredcompleted. The bytes are sent and a new SSL_write() operation with a newbuffer (with the already sent bytes removed) must be started.A partial write is performed with the size of a message block, which is16kB for SSLv3/TLSv1.=head1 WARNINGWhen an SSL_write() operation has to be repeated because ofB<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeatedwith the same arguments.When calling SSL_write() with num=0 bytes to be sent the behaviour isundefined.=head1 RETURN VALUESThe following return values can occur:=over 4=item E<gt>0The write operation was successful, the return value is the number ofbytes actually written to the TLS/SSL connection.=item 0The write operation was not successful. Probably the underlying connectionwas closed. Call SSL_get_error() with the return value B<ret> to find out,whether an error occurred or the connection was shut down cleanly(SSL_ERROR_ZERO_RETURN).SSLv2 (deprecated) does not support a shutdown alert protocol, so it canonly be detected, whether the underlying connection was closed. It cannotbe checked, why the closure happened.=item E<lt>0The write operation was not successful, because either an error occurredor action must be taken by the calling process. Call SSL_get_error() with thereturn value B<ret> to find out the reason.=back=head1 SEE ALSOL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_read(3)|SSL_read(3)>,L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>,L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>,L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -