|
Description
The user sends a datagram to another transport user in connectionless mode with the t_sndudata() function.
The fd parameter specifies the local transport endpoint over which the datagram is sent.
The unitdata parameter is a pointer to an object of type struct t_unitdata.
The t_unitdata structure is declared in <xti.h> as follows:
struct t_unitdata { struct netbuf addr; struct netbuf opt; struct netbuf udata; };
Before calling t_rcvudata(), the user specifies the destination protocol address in unitdata->addr and the data to be transferred in unitdata->udata.
Setting protocol-specific options in unitdata->opt is not supported by the transport provider.
If the user specified the value 0 in unitdata->addr.len and the transport provider does not support sending null bytes, t_sndudata() returns the value -1 and sets t_errno to TBADDATA.
By default, t_sndudata() works in synchronous mode and waits (blocks) if flow control limits prevent the transport provider from accepting the datagram at the time of the t_sndudata() call.
However, if O_NDELAY or O_NONBLOCK was previously set with t_open() or the POSIX fcntl() function for the transport endpoint specified with fd, t_sndudata() works in asynchronous mode and terminates with an error if the transport provider does not accept the datagram immediately.
If t_sndudata() was called in an invalid state or the datagram length specified in unitdata->udata.len is greater than the TSDU length, the transport provider generates an EPROTO protocol error (see the TSYSERR error). If the EPROTO error was generated because of an invalid state, it is only reported when transport endpoint fd is referenced. The length of the TSDU (transport service data unit) is returned by the t_open() and t_getinfo() functions.
Return value
0:
If successful.
-1:
If an error occurs. t_ errno is set to indicate the error.
Errors
TBADADDR
The specified protocol address had the wrong format or contained invalid information.
TBADDATA
The nbytes parameter has the value 0, but sending null bytes is not supported by the underlying transport provider, or the message was too long to be sent in one piece.
TBADF
The specified file descriptor does not reference a transport endpoint.
TFLOW
O_NDELAY or O_NONBLOCK was set but the flow control has not allowed the transport provider to accept data at this time.
TLOOK
An asynchronous event occurred on the transport endpoint passed in fd and this must be processed immediately.
TNOTSUPPORT
This function is not supported by the underlying transport provider.
TSYSERR
A system error occurred during execution of this function.
In the present case, the errno error variable contains more detailed information:
EFAULT | The area specified in unitdata->addr, unitdata->opt or unitdata->udata is outside the process address range. |
ENOBUFS | Not enough system resources are currently available to execute the send job. |
EINTR | The call was interrupted by a signal. |