t_sndudata(3xti)
Name
t_sndudata − send a data unit
Syntax
#include <xti.h>
int t_sndudata(fd, unitdata)
int fd;
struct t_unitdata *unitdata;
Arguments
fdIdentifies the local transport endpoint through which data will be sent.
unitdataPoints to a t_unitdata structure containing the following members:
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
The members have the following meanings:
addrSpecifies the protocol address of the destination user.
optIdentifies protocol-specific options that the user wants associated with the request.
udataSpecifies the user data to be sent.
Description
This function is used in connectionless mode to send a data unit to another transport user.
| Parameters | Before Call | After Call |
| fd | x | / |
| unitdata->addr.maxlen | / | / |
| unitdata->addr.len | x | / |
| unitdata->opt.maxlen | / | / |
| unitdata->opt.len | x | / |
| unitdata->opt.buf | ?(?) | / |
| unitdata->udata.maxlen | / | / |
| unitdata->udata.len | x | / |
| unitdata->udata.buf | x(x) | / |
If the len field of udata is zero, and sending of zero octets is not supported by the underlying transport service, the t_sndudata() returns −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_NONBLOCK is set by means of t_open() or fcntl(), t_sndudata() executes in asynchronous mode and fails under such conditions. The process can arrange to be notified of the clearance of a flow control restriction by means of t_look().
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() or t_getinfo(), the provider generates a protocol error. See [TSYSERR] under the DIAGNOSTICS section. If t_sndudata() is issued before the destination user has activated its transport endpoint, the data unit can be discarded.
Return Values
Upon successful completion, a value of 0 is returned. On failure, a value of −1 is returned, and t_errno is set to indicate the error.
Diagnostics
On failure, t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a transport endpoint.
[TOUTSTATE] The function was issued in the wrong sequence on the transport endpoint referenced by fd.
[TFLOW] O_NONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting any data at this time.
[TBADDATA] Illegal amount of data; zero octets are not supported.
[TLOOK] An asynchronous event has occurred on the transport endpoint.
[TNOTSUPPORT] This function is not supported by the underlying transport provider.
[TSYSERR] A system error has occurred during execution of this function. A protocol error cannot cause t_sndudata() to fail until a subsequent access of the transport endpoint.
See Also
fcntl(2), t_alloc(3xti), t_open(3xti), t_rcvudata(3xti), t_rcvuderr(3xti)