t_rcv(S) (TLI/XTI) 6 January 1993 t_rcv(S) Name t_rcv - receive data or expedited data sent over a connection Syntax TLI syntax cc . . . -lnsls #include <sys/tiuser.h> int t_rcv (fd, buf, nbytes, flags) int fd; char *buf; unsigned nbytes; int *flags; XTI syntax cc . . . -lxti #include <xti.h> int t_rcv (fd, buf, nbytes, flags) 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 arrives; buf points to a receive buffer where user data is placed; and nbytes specifies the size of the receive buffer. flags may be set on return from trcv and speci- fies optional flags as described below. By default, trcv operates in synchronous mode and waits for data to arrive if none is currently available. However, if ONONBLOCK is set (via topen or fcntl), trcv executes in asynchronous mode and fails 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 multi- ple trcv calls. Each trcv with the TMORE flag set indicates that another trcv must follow immediately 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 argument 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 sets TEXPEDITED and TMORE on return from the initial call. Subsequent calls to retrieve the remaining ETSDU do not 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 is suspended until the ETSDU has been processed. Only after the full ETSDU has been retrieved (TMORE not set) is the remainder of the TSDU 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. [TLOOK] An asynchronous event has occurred on this transport endpoint and requires immediate attention. [TNODATA] ONONBLOCK was set, but no data is currently available from the transport provider. errno is set to EAGAIN. [TNOTSUPPORT] This function is not supported by the underlying transport provider. [TOUTSTATE] (XTI only.) The state was incorrect when this routine was called. [TSYSERR] A system error occurred during execution of this func- tion. One possible event is a protocol error; when this is the case, errno is set to EPROTO. 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. See also topen(S), tsnd(S), Standards conformance trcv is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2).