[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

t_sndudata Subroutine for X/Open Transport Interface

Purpose

Send a data unit.

Library

X/Open Transport Interface Library (libxti.a)

Syntax

#include <xti.h>

int t_sndudata (
    int fd,
    const struct t_unitdata *unitdata)

Description

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

By default, the t_sndudata subroutine operates in synchronous mode and waits if flow control restrictions prevents the data from being accepted by the local transport provider at the time the call is made. However, if O_NONBLOCK is set (via the t_open subroutine or fcntl), the t_sndudata subroutine executes in asynchronous mode and fails under such conditions. The process can arrange to be notified of the clearance of a flow control restriction via either the t_look subroutine or the Event Management interface.

If the amount of data specified in the udata field exceeds the TSDU size as returned in the t_open or t_getinfo subroutines info parameter tsdu field, a TBADDATA error will be generated. If the t_sndudata subroutine is called before the destination user has activated its transport endpoint (see the t_bind subroutine), the data unit may be discarded.

If it is not possible for the transport provider to immediately detect the conditions that cause the errors TBADDADDR and TBADOPT. These errors will alternatively be returned by the t_rcvuderr subroutine. Therefore, an application must be prepared to receive these errors in both of these ways.

Parameters

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

In the unitdata structure:

addr Specifies the protocol address of the destination user.
opt Identifies options that the user wants associated with this request.The user may choose not to specify what protocol options are associated with the transfer by setting the len field of opt to zero. In this case, the provider may use default options.
udata Specifies the user data to be sent. If the len field of udata is zero, and sending of zero octets is not supported by the underlying transport service, the t_sndudata subroutine returns -1 with t_errno set to TBADDATA.

Valid States

T_IDLE

Return Values

0 Successful completion.
-1 t_errno is set to indicate an error.

Error Codes

On failure, t_errno is set to one of the following:

TBADADDR The specified protocol address was in an incorrect format or contained illegal information.
TBADDATA Illegal amount of data. A single send was attempted specifying a TSDU greater than that specified in the info parameter, or a send of a zero byte TSDU is not supported by the provider.
TBADF The specified file descriptor does not refer to a transport endpoint.
TBADOPT The specified options were in an incorrect format or contained illegal information.
TFLOW O_NONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting any data at this time.
TLOOK An asynchronous event has occurred on the transport endpoint.
TNOTSUPPORT This subroutine is not supported by the underlying transport provider.
TOUTSTATE The subroutine was issued in the wrong sequence on the transport endpoint referenced by the fd parameter.
TPROTO This error indicates that a communication problem has been detected between the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno).
TSYSERR A system error has occurred during execution of this subroutine.

Related Information

The fcntl subroutine, t_alloc subroutine, t_open subroutine, t_rcvudata subroutine, t_rcvuderr subroutine.


[ Previous | Next | Contents | Glossary | Home | Search ]