[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    t_sndudata(3N) manual page Table of Contents

Name

t_sndudata - send a data unit

Synopsis

cc [ flag ... ] file ... -lnsl [ library ... ]

#include <tiuser.h>

int t_sndudata(int fildes, struct t_unitdata *unitdata);

MT-Level

MT-Safe

Description

This function is used in connectionless mode to send a data unit to another transport user. fildes identifies the local transport endpoint through which data will be sent, and unitdata points to a t_unitdata structure containing the following members:


    struct netbuf    addr;
    struct netbuf    opt;
    struct netbuf    udata;

netbuf is described in t_connect(3N) . In unitdata, addr specifies the protocol address of the destination user, opt identifies protocol-specific options that the user wants associated with this request, and udata specifies the user data to be sent. 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.

If the len field of udata is zero, and the sending of zero bytes is not supported by the underlying transport provider, t_sndudata will return -1 with t_errno set to TBADDATA .

By default, t_sndudata() 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 O_NDELAY or O_NONBLOCK is set (using t_open(3N) or fcntl(2) ), t_sndudata() will execute in asynchronous mode and will fail under such conditions.

If t_sndudata() is issued from an invalid state, or if the amount of data specified in udata exceeds the TSDU size as returned in the tsdu field of the info argument of t_open(3N) or t_getinfo(3N) , the provider will generate an EPROTO protocol error. (See TSYSERR below.) If the state is invalid, this error may not occur until a subsequent reference is made to the transport endpoint.

Return Values

t_sndudata() returns 0 on successful completion. On failure t_sndudata() returns -1, t_errno is set to indicate the error, and possibly errno is set.

Errors

On failure, t_errno will be set to one of the following:

TBADDATA
nbytes is zero and sending zero bytes is not supported by the transport provider.
TBADF
The specified file descriptor does not refer to a transport endpoint.
TFLOW]
O_NDELAY or O_NONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting data at this time.
TNOTSUPPORT
This function is not supported by the underlying transport provider.
TSYSERR
A system error has occurred during execution of this function, errno will be set to the specific error.

See Also

fcntl(2) , t_connect(3N) , t_getinfo(3N) , t_rcvudata(3N) , t_rcvuderr(3N)

Notes

This interface is safe in multithreaded applications.


Table of Contents