[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

t_rcvudata Subroutine for Transport Layer Interface

Purpose

Receives a data unit.

Library

Transport Layer Interface Library (libtli.a)

Syntax

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

Description

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

Parameters

fd Identifies the local transport end point 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 protocol-specific options that were associated with this data unit.
udata Specifies the user data that was received.
Note: The maxlen field of the addr, opt, and udata fields must be set before issuing this function to indicate the maximum size of the buffer for each.
flags Indicates that the complete data unit was not received.

By default, the t_rcvudata subroutine operates in synchronous mode and will wait for a data unit to arrive if none is currently available. However, if the O_NDELAY or O_NONBLOCK flag is set (using the t_open subroutine or fcntl command), the t_rcvudata subroutine will run in asynchronous mode and will stop if no data units are available.

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

Return Values

On successful completion, the t_rcvudata subroutine returns a value of 0. Otherwise, it returns a value of -1 and sets the t_errno variable to indicate the error.

Error Codes

If unsuccessful, the t_errno variable is set to one of the following:

TBADF The specified file descriptor does not refer to a transport end point.
TBUFOVFLW The number of bytes allocated for the incoming protocol address of options is not sufficient to store the information. (The unit data information to be returned in the unitdata parameter will be discarded.)
TLOOK An asynchronous event has occurred on this transport endpoint and requires immediate attention.
TNODATA The O_DELAY or O_NONBLOCK flag was set, but no data units are currently available from the transport provider.
TNOTSUPPORT This subroutine is not supported by the underlying transport provider.
TOUTSTATE The subroutine was issued in the wrong sequence.
TSYSERR A system error has occurred during operation of this subroutine.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

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

List of Streams Programming References and STREAMS Overview in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]