|
Description
The user sends data with the t_snd() function.
The fd parameter specifies the local transport endpoint over which the data is to be sent.
buf is a pointer to the user data to be sent.
The user specifies the length of the user data (in bytes) to be sent, with nbytes.
flags is not supported by the transport provider and the value 0 must therefore be passed for flags with the t_snd() call.
By default, t_snd() works in synchronous mode and waits (blocks) if flow control limits prevent all data being taken over by the transport provider at the time of the t_snd() 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_snd() is executed in asynchronous mode and terminates with an error if flow control limits exist.
After successful execution, the return value of t_snd() defines the number of data bytes accepted by the transport provider. This number normally corresponds to the value passed in the nbytes parameter. However, in asynchronous mode it is possible that only part of the data to be sent is accepted by the transport provider. In this case, t_snd() returns a value less than nbytes.
Return value
After successful execution, t_snd() returns the number of bytes accepted by the transport provider.
If an error occurs, t_errno is set to -1 to indicate the error.
Errors
TBADDATA
The nbytes parameter has the value 0, but sending null bytes is not supported by the underlying transport provider.
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.
TOUTSTATE
The function was called in the wrong position within a sequence of XTI function calls for transport endpoint fd.
TSYSERR
A system error occurred during execution of this function.