


T_RCVUDATA(3N)          NETWORK FUNCTIONS          T_RCVUDATA(3N)



NAME
     t_rcvudata - receive a data unit

SYNOPSIS
     #include <tiuser.h>

     int t_rcvudata(fd, unitdata, flags)
     int fd;
     struct t_unitdata *unitdata;
     int *flags;

DESCRIPTION
     t_rcvudata() is used in connectionless  mode  to  receive  a
     data  unit  from  another transport user.  _f_d identifies the
     local  transport  endpoint  through  which  data   will   be
     received,  _u_n_i_t_d_a_t_a  holds  information  associated with the
     received data unit, and _f_l_a_g_s is set on return  to  indicate
     that  the  complete  data  unit  was not received.  _u_n_i_t_d_a_t_a
     points   to    a    _t__u_n_i_t_d_a_t_a    structure    defined    in
     <nettli/tiuser.h> as:
          struct t_unitdata {
               struct netbuf addr;             /* address        */
               struct netbuf opt;              /* options        */
               struct netbuf udata;            /* user data      */
          };

     The _m_a_x_l_e_n, _l_e_n, and _b_u_f members of the _n_e_t_b_u_f structure are
     described  in  t_accept(3N).  The _m_a_x_l_e_n field of _a_d_d_r, _o_p_t,
     and _u_d_a_t_a must be set before issuing t_rcvudata()  to  indi-
     cate the maximum size of the buffer for each.

     On return  from  this  call,  _a_d_d_r  specifies  the  protocol
     address  of  the  sending  user,  _o_p_t  identifies  protocol-
     specific options that were associated with this  data  unit,
     and _u_d_a_t_a specifies the user data that was received.

     By default, t_rcvudata() operates in  synchronous  mode  and
     will  wait  for  a  data unit to arrive if none is currently
     available.  However, if O_NDELAY is set (using t_open(3N) or
     fcntl()), t_rcvudata() will execute in asynchronous mode and
     will fail if no data units are available.

     If the buffer defined in the _u_d_a_t_a field of _u_n_i_t_d_a_t_a is  not
     large  enough to hold the current data unit, the buffer will
     be filled and T_MORE will be set in _f_l_a_g_s on return to indi-
     cate  that another t_rcvudata() should be issued to retrieve
     the rest of the data unit.  Subsequent t_rcvudata()  call(s)
     will  return  zero for the length of the address and options
     until the full data unit has been received.

RETURN VALUES




Sun Release 4.1   Last change: 21 January 1990                  1






T_RCVUDATA(3N)          NETWORK FUNCTIONS          T_RCVUDATA(3N)



     t_rcvudata() returns:

     0    on success.

     -1   on failure and sets t_errno to indicate the error.

ERRORS
     TBADF               The specified file descriptor  does  not
                         refer to a transport endpoint.

     TBUFOVFLW           The number of bytes  allocated  for  the
                         incoming  protocol address or options is
                         not sufficient to store the information.
                         The unit data information to be returned
                         in _u_n_i_t_d_a_t_a will be discarded.

     TLOOK               An asynchronous event  has  occurred  on
                         this  transport  endpoint  and  requires
                         immediate attention.

     TNODATA             T_NDELAY was set, but no data units  are
                         currently  available  from the transport
                         provider.

     TNOTSUPPORT         This function is not  supported  by  the
                         underlying transport provider.

     TSYSERR             The function  failed  due  to  a  system
                         error  and  set  errno  to  indicate the
                         error.

SEE ALSO
     intro(3), t_rcvuderr(3N), t_sndudata(3N)



















Sun Release 4.1   Last change: 21 January 1990                  2






