gtpc1m6f | Transmission Control Protocol/Internet Protocol |
The SSL_write function writes application data across a Secure
Sockets Layer (SSL) session.
Format
#include <openssl/ssl.h>
int SSL_write(SSL *ssl,const char *buf,int num)
- ssl
- A pointer to a token returned on the SSL_new call.
- buf
- A pointer to the data to send.
- num
- The number of bytes of data to send. The maximum number of byte
that can be sent is 32 000 for sessions using SSL version 2.
Normal Return
Returns the number of bytes of data (from 1 to the value specified on the
num parameter) sent.
Error Return
A return code equal to 0 or a negative number indicates an error.
Issue the SSL_get_error function to obtain specific information
about the error.
Programming Considerations
- Normally, the SSL_write function processes all data passed by
the application, in which case the return code is equal to the value specified
for the num parameter. However, if the socket becomes
blocked during processing, it is possible that only some of the data will be
processed, in which case the return code is greater than 0, but less than the
value specified for the num parameter. When this occurs, you must
adjust the value specified on the buf parameter and the value specified for
the num parameter, and then issue the SSL_write function
again to send the remaining data.
- If this is a shared SSL session, the socket will be changed to nonblocking
mode when the SSL_write function is completed.
Examples
For sample SSL applications, go to http://www.ibm.com/tpf/pubs/tpfpubs.htm,
click SSL for the TPF 4.1 System: An Online User's
Guide, and click Examples from the left navigation
bar.
Related Information
SSL_new.