@deftypefun {int} {gnutls_record_get_direction} (gnutls_session_t @var{session}) @var{session}: is a @code{gnutls_session_t} type. This function is useful to determine whether a GnuTLS function was interrupted while sending or receiving, so that @code{select()} or @code{poll()} may be called appropriately. It provides information about the internals of the record protocol and is only useful if a prior gnutls function call, e.g. @code{gnutls_handshake()} , was interrupted and returned @code{GNUTLS_E_INTERRUPTED} or @code{GNUTLS_E_AGAIN} . After such an interrupt applications may call @code{select()} or @code{poll()} before restoring the interrupted GnuTLS function. This function's output is unreliable if you are using the same @code{session} in different threads for sending and receiving. @strong{Returns:} 0 if interrupted while trying to read data, or 1 while trying to write data. @end deftypefun