[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

t_rcvudata Subroutine for X/Open Transport Interface


Receive a data unit.


X/Open Transport Interface Library (libxti.a)


#include <xti.h>
int t_rcvudata (fd, unitdata, flags)
int fd;
struct t_unitdata *unitdata;
int *flags;


The t_rcvudata subroutine is used in connectionless mode to receive a data unit from another transport user.

By default, the t_rcvudata subroutine operates in synchronous mode and waits for a data unit to arrive if none is currently available. However, if O_NONBLOCK is set (via the t_open subroutine or fcntl), the t_rcvudata subroutine executes in asynchronous mode and fails if no data units are available.

If the buffer defined in the udata field of the unitdata parameter is not large enough to hold the current data unit, the buffer is filled and T_MORE is set in the flags parameter on return to indicate that another t_rcvudata subroutine should be called to retrieve the rest of the data unit. Subsequent calls to the t_rcvudata subroutine return zero for the length and options until the full data unit is received.


fd Identifies the local transport endpoint through which data will be received.
unitdata Holds information associated with the received data unit. The unitdata parameter points to a t_unitdata structure containing the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;

On return from this call:

addr Specifies the protocol address of the sending user.
opt Identifies options that were associated with this data unit.
udata Specifies the user data that was received.

The maxlen field of addr, opt, and udata must be set before calling this subroutine to indicate the maximum size of the buffer for each.

flags Indicates that the complete data unit was not received.

Valid States


Return Values

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and t_errno is set to indicate an error.

Error Codes

On failure, t_errno is set to one of the following:

TBADF The specified file descriptor does not refer to a transport endpoint.
TBODATA O_NONBLOCK was set, but no data units are currently available from the transport provider.
TBUFOVFLW The number of bytes allocated for the incoming protocol address or options (maxlen) is greater than 0 but not sufficient to store the information. The unit data information to be returned in the unitdata parameter is discarded.
TLOOK An asynchronous event has occurred on the transport endpoint and requires immediate attention.
TNOTSUPPORT This subroutine is not supported by the underlying transport provider.
TOUTSTATE The subroutine was issued in the wrong sequence on the transport endpoint referenced by the fd parameter.
TPROTO This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno).
TSYSERR A system error has occurred during execution of this subroutine.

Related Information

The fcntl subroutine, t_alloc subroutine, t_open subroutine, t_rcvuderr subroutine, t_sndudata subroutine.

[ Previous | Next | Contents | Glossary | Home | Search ]