Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
gsk_secure_soc_read() z/OS Cryptographic Services System SSL Programming SC14-7495-00 |
|
Reads data using a secure socket connection. Format
Parameters
ResultsThe function return value will be
the number of bytes read if no error is detected. Otherwise, it will
be a negative value representing one of the return codes listed in
the gskssl.h include file. These are some possible errors:
UsageThe gsk_secure_soc_read() routine reads data from a secure socket connection and returns it in the application buffer. SSL is a record-based protocol and a single call will never return more than a single SSL record. The maximum amount of data returned by gsk_secure_soc_read() is 16384 (16K) bytes. If the SSL V2 protocol is used, then the maximum length is 16384 minus the length of the SSL protocol headers. The application can read an entire SSL record in a single call by supplying a buffer large enough to contain the record. Otherwise, multiple calls will be required to retrieve the entire SSL record. SSL supports multiple threads but only one thread at a time can call the gsk_secure_soc_read() routine for a given connection handle. Multiple concurrent threads can call gsk_secure_soc_read() if each thread has its own connection handle. SSL supports sockets in blocking mode and in non-blocking mode. When a socket is in non-blocking mode and a complete SSL record is not available, gsk_secure_soc_read() will return with GSK_ERROR_WOULD_BLOCK. No data will be returned in the application buffer when GSK_ERROR_WOULD_BLOCK is returned. The application should call gsk_secure_soc_read() again when there is data available to be read from the socket. The peer application can initiate an SSL handshake sequence after the connection is established. If this is done and the socket is in non-blocking mode, it is possible for gsk_secure_soc_read() to return with GSK_ERROR_WOULD_BLOCK_WRITE. This indicates that an SSL handshake is in progress and the application should call gsk_secure_soc_read() again when data can be written to the socket. No data will be returned in the application buffer when GSK_ERROR_WOULD_BLOCK_WRITE is returned. The application should not read data directly from the socket since this can cause SSL protocol errors if the application inadvertently reads part of an SSL record. If the application must read data from the socket, it is responsible for synchronizing this activity with the peer application so that no SSL records are sent while the application is performing its own read operations. |
Copyright IBM Corporation 1990, 2014
|