1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
@deftypefun {ssize_t} {gnutls_record_recv} (gnutls_session_t @var{session}, void * @var{data}, size_t @var{data_size})
@var{session}: is a @code{gnutls_session_t} structure.
@var{data}: the buffer that the data will be read into
@var{data_size}: the number of requested bytes
This function has the similar semantics with @code{recv()} . The only
difference is that it accepts a GnuTLS session, and uses different
error codes.
In the special case that a server requests a renegotiation, the
client may receive an error code of @code{GNUTLS_E_REHANDSHAKE} . This
message may be simply ignored, replied with an alert
@code{GNUTLS_A_NO_RENEGOTIATION} , or replied with a new handshake,
depending on the client's will.
If @code{EINTR} is returned by the internal push function (the default
is @code{recv()} ) then @code{GNUTLS_E_INTERRUPTED} will be returned. If
@code{GNUTLS_E_INTERRUPTED} or @code{GNUTLS_E_AGAIN} is returned, you must
call this function again to get the data. See also
@code{gnutls_record_get_direction()} .
A server may also receive @code{GNUTLS_E_REHANDSHAKE} when a client has
initiated a handshake. In that case the server can only initiate a
handshake or terminate the connection.
@strong{Returns:} The number of bytes received and zero on EOF (for stream
connections). A negative error code is returned in case of an error.
The number of bytes received might be less than the requested @code{data_size} .
@end deftypefun
|