DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 
(TLI/XTI)

t_rcv(NET)


t_rcv -- receive data or expedited data sent over a connection

Syntax

TLI syntax

cc . . . -lnsl

#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

The t_rcv 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 t_rcv and specifies optional flags as described below.

By default, t_rcv operates in synchronous mode and waits for data to arrive if none is currently available. However, if O_NONBLOCK is set (via t_open or fcntl), t_rcv executes in asynchronous mode and fails if no data is available. (See TNODATA below.)

On return from the call, if T_MORE 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 t_rcv calls. Each t_rcv with the T_MORE flag set indicates that another t_rcv must follow immediately to get more data for the current TSDU. The end of the TSDU is identified by the return of a t_rcv call with the T_MORE flag not set. If the transport provider does not support the concept of a TSDU as indicated in the info argument on return from t_open or t_getinfo, the T_MORE flag is not meaningful and should be ignored.

On return, the data returned is expedited data if T_EXPEDITED is set in flags. If the number of bytes of expedited data exceeds nbytes, t_rcv sets T_EXPEDITED and T_MORE on return from the initial call. Subsequent calls to retrieve the remaining ETSDU do not have T_EXPEDITED set on return. The end of the ETSDU is identified by the return of a t_rcv call with the T_MORE 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 (T_MORE not set) is the remainder of the TSDU available to the user.

Return values

On successful completion, t_rcv returns the number of bytes received. and it On failure, it returns -1 and sets t_errno to indicate the error.

Diagnostics

On failure, t_errno 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]
O_NONBLOCK 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]
The state was incorrect when this routine was called; XTI only.

[TSYSERR]
A system error occurred during execution of this function. One possible event is a protocol error; when this is the case, errno is set to EPROTO.

See also

Intro(NET), t_getinfo(NET), t_open(NET), t_snd(NET)

Standards conformance

t_rcv is conformant with:

AT&T SVID Issue 3 ;
X/Open CAE Specification, Networking Services, Issue 4, 1994. ;
and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003