Send data or expedited data over a connection.
X/Open Transport Interface Library (libxti.a)
#include <xti.h> int t_snd ( int fd, void *buf, unsigned int nbytes, int *flags)
The t_snd subroutine is used to send either normal or expedited data. By default, the t_snd subroutine operates in synchronous mode and may wait 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_snd subroutine executes in asynchronous mode, and fails immediately if there are flow control restrictions. The process can arrange to be informed when the flow control restrictions are cleared via either the t_look subroutine or the Event Management interface.
On successful completion, the t_snd subroutine returns the number of bytes accepted by the transport provider. Normally this equals the number of bytes specified in the nbytes parameter. However, if O_NONBLOCK is set, it is possible that only part of the data is actually accepted by the transport provider. In this case, the t_snd subroutine returns a value that is less than the value of the nbytes parameter. If the value of the nbytes parameter is zero and sending of zero octets is not supported by the underlying transport service, the t_snd subroutine returns -1 with t_errno set to TBADDATA.
|fd||Identifies the local transport endpoint over which data should be sent.|
|buf||Points to the user data.|
|nbytes||Specifies the number of bytes of user data to be sent.|
|flags|| Specifies any optional flags described below:
On successful completion, the t_snd subroutine returns the number of bytes accepted by the transport provider. Otherwise, -1 is returned on failure and t_errno is set to indicate the error.
Note, that in asynchronous mode, if the number of bytes accepted by the transport provider is less than the number of bytes requested, this may indicate that the transport provider is blocked due to flow control.
On failure, t_errno is set to one of the following:
|TBADF||The specified file descriptor does not refer to a transport endpoint.|
|TBADDATA|| Illegal amount of data:
|TBADFLAG||An invalid flag was specified.|
|TFLOW||O_NONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting any data at this time.|
|TNOTSUPPORT||This subroutine is not supported by the underlying transport provider.|
|TLOOK||An asynchronous event has occurred on this transport endpoint.|
|TOUTSTATE||The subroutine was issued in the wrong sequence on the transport endpoint referenced by the fd parameter.|
|TSYSERR||A system error has occurred during execution of this subroutine.|
|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).|
It is important to remember that the transport provider treats all users of a transport endpoint as a single user. Therefore if several processes issue concurrent t_snd calls then the different data may be intermixed.
Multiple sends which exceed the maximum TSDU or ETSDU size may not be discovered by the X/Open Transport Interface. In this case an implementation-dependent error will result (generated by the transport provider) perhaps on a subsequent XTI call. This error may take the form of a connection abort, a TSYSERR. a TBADDATA or a TPROTO error.
If multiple sends which exceed the maximum TSDU or ETSDU size are detected by the X/Open Transport Interface, t_snd fails with TBADDATA.
The t_getinfo subroutine, t_open subroutine, t_rcv subroutine.