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

t_sndudata Subroutine for Transport Layer Interface

Purpose

Sends a data unit to another transport user.

Library

Transport Layer Interface Library (libtli.a)

Syntax

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

Description

The t_sndudata subroutine is used in connectionless mode to send a data unit to another transport user.

By default, the t_sndudata subroutine operates in synchronous mode and may wait if flow-control restrictions prevent the data from being accepted by the local transport provider at the time the call is made. However, if the O_NDELAY or O_NONBLOCK flag is set (using the t_open subroutine or the fcntl command), the t_sndudata subroutine runs in asynchronous mode and fails under such conditions.

Parameters

fd Identifies the local transport endpoint through which data is sent.
unitdata Points to a t_unitdata structure containing the following elements:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;

The elements are defined as follows:

addr Specifies the protocol address of the destination user.
opt Identifies protocol-specific options that the user wants associated with this request.
udata Specifies the user data to be sent. The user can choose not to specify what protocol options are associated with the transfer by setting the len field of the opt field to 0. In this case, the provider can use default options.

If the len field of the udata field is 0, no data unit is passed to the transport provider; the t_sndudata subroutine does not send zero-length data units.

If the t_sndudata subroutine is issued from an invalid state, or if the amount of data specified in the udata field exceeds the TSDU size as returned by the t_open or t_getinfo subroutine, the provider generates an EPROTO protocol error.

Return Values

On successful completion, the t_sndudata 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:

TBADDATA The amount of user data specified was not within the bounds allowed by the transport provider.
TBADF The specified file descriptor does not refer to a transport endpoint.
TFLOW The O_NDELAY or O_NONBLOCK flag was set, but the flow-control mechanism prevented the transport provider from accepting data at this time.
TLOOK An asynchronous event has occurred on this transport end point and requires immediate attention.
TNOTSUPPORT This subroutine is not supported by the underlying transport provider.
TOUTSTATE This subroutine was issued in the wrong sequence.
TSYSERR A system error has occurred during execution 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_rcvudata subroutine, t_rcvuderr 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 ]