t_rcv(3N) LIBRARY FUNCTIONS t_rcv(3N)
NAME
trcv - receive data or expedited data sent over a connec-
tion
SYNOPSIS
int trcv (int fd, char *buf, unsigned nbytes, int *flags);
DESCRIPTION
This function receives either normal or expedited data. fd
identifies the local transport endpoint through which data
will arrive, buf points to a receive buffer where user data
will be placed, and nbytes specifies the size of the receive
buffer. flags may be set on return from trcv and specifies
optional flags as described below.
By default, trcv operates in synchronous mode and will wait
for data to arrive if none is currently available. However,
if ONDELAY or ONONBLOCK is set (via topen or fcntl),
trcv will execute in asynchronous mode and will fail if no
data is available. (See TNODATA below.)
On return from the call, if TMORE is set in flags, this
indicates that there is more data and the current transport
service data unit (TSDU) or expedited transport service data
unit (ETSDU) must be received in multiple trcv calls. Each
trcv with the TMORE flag set indicates that another trcv
must follow to get more data for the current TSDU. The end
of the TSDU is identified by the return of a trcv call with
the TMORE flag not set. If the transport provider does not
support the concept of a TSDU as indicated in the info argu-
ment on return from topen or tgetinfo, the TMORE flag is
not meaningful and should be ignored.
On return, the data returned is expedited data if
TEXPEDITED is set in flags. If the number of bytes of
expedited data exceeds nbytes, trcv will set TEXPEDITED
and TMORE on return from the initial call. Subsequent
calls to retrieve the remaining ETSDU will have TEXPEDITED
set on return. The end of the ETSDU is identified by the
return of a trcv call with the TMORE flag not set. If
expedited data arrives after part of a TSDU has been
retrieved, receipt of the remainder of the TSDU will be
suspended until the ETSDU has been processed. Only after
the full ETSDU has been retrieved (TMORE not set) will the
remainder of the TSDU be available to the user. On failure,
terrno may be set to one of the following:
[TBADF] The specified file descriptor does not
refer to a transport endpoint.
[TNODATA] ONDELAY or ONONBLOCK was set, but no
data is currently available from the
1
t_rcv(3N) LIBRARY FUNCTIONS t_rcv(3N)
transport provider.
[TLOOK] An asynchronous event has occurred on
this transport endpoint and requires
immediate attention.
[TNOTSUPPORT] This function is not supported by the
underlying transport provider.
[TSYSERR] A system error has occurred during execu-
tion of this function.
SEE ALSO
topen(3N), tsnd(3N).
UNIX System V Network Programmer's Guide.
DIAGNOSTICS
On successful completion, trcv returns the number of bytes
received, and it returns -1 on failure and terrno is set to
indicate the error.
2