Send data or expedited data, from one or more non-contiguous buffers, on a connection.
Standard library (libxti.a)
#include <xti.h> int t_sndv (int fd, const struct t_iovec *iov, unsigned it iovcount, int flags)
|Parameters||Before call||After call|
|. . . .|
This function is used to send either normal or expedited data. The argument fd identifies the local transport endpoint over which data should be sent, iov points to an array of buffer address/buffer length pairs. t_sndv sends data contained in buffers iov, iov, through iov[iovcount-1]. iovcount contains the number of non-contiguous data buffers which is limited to T_IOV_MAX (an implementation-defined value of at least 16). If the limit is exceeded, the function fails with [TBADDATA].
Note: The limit on the total number of bytes available in all buffers passed (that is: iov(0).iov_len + . . + iov(iovcount-1).iov_len) may be constrained by implementation limits. If no other constraint applies, it will be limited by [INT_MAX]. In practice, the availability of memory to an application is likely to impose a lower limit on the amount of data that can be sent or received using scatter/gather functions.
The argument flags specifies any optional flags described below:
If set in flags, requests that the provider transmit all data that it has accumulated but not sent. The request is a local action on the provider and does not affect any similarly named protocol flag (for example, the TCP PUSH flag). This effect of setting this flag is protocol-dependent, and it may be ignored entirely by transport providers which do not support the use of this feature.
Note: The communications provider is free to collect data in a send buffer until it accumulates a sufficient amount for transmission.
By default, t_sndv 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 (via t_open or fcntl), t_sndv executes in asynchronous mode, and will fail immediately if there are flow control restrictions. The process can arrange to be informed when the flow control restrictions are cleared via either t_look or the EM interface.
On successful completion, t_sndv returns the number of bytes accepted by the transport provider. Normally this will equal the total number of bytes to be sent, that is,
(iov.iov_len + . . + iov[iovcount-1].iov_len)
However, the interface is constrained to send at most INT_MAX bytes in a single send. When t_sndv has submitted INT_MAX (or lower constrained value, see the note above) bytes to the provider for a single call, this value is returned to the user. However, if O_NONBLOCK is set or the function is interrupted by a signal, it is possible that only part of the data has actually been accepted by the communications provider. In this case, t_sndv returns a value that is less than the value of nbytes. If t_sndv is interrupted by a signal before it could transfer data to the communications provider, it returns -1 with t_errno set to [TSYSERR] and errno set to [EINTR].
If the number of bytes of data in the iov array is zero and sending of zero octets is not supported by the underlying transport service, t_sndv returns -1 with t_errno set to [TBADDATA].
The size of each TSDU or ETSDU must not exceed the limits of the transport provider as specified by the current values in the TSDU or ETSDU fields in the info argument returned by t_getinfo.
The error [TLOOK] is returned for asynchronous events. It is required only for an incoming disconnect event but may be returned for other events.
On successful completion, t_sndv 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.
- In synchronous mode, if more than INT_MAX bytes of data are passed in the iov array, only the first INT_MAX bytes will be passed to the provider.
- If the number of bytes accepted by the communications provider is less than the number of bytes requested, this may either indicate that O_NONBLOCK is set and the communications provider is blocked due to flow control, or that O_NONBLOCK is clear and the function was interrupted by a signal.
On failure, t_errno is set to one of the following:
|TBADDATA||Illegal amount of data:|
|TBADF||The specified file descriptor does not refer to a transport endpoint.|
|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.|
|TLOOK||An asynchronous event has occurred on this transport endpoint.|
|TNOTSUPPORT||This function is not supported by the underlying transport provider.|
|TOUTSTATE||The communications endpoint referenced by fd is not in one of the states in which a call to this function is valid.|
|TPROTO||This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI error (t_errno).|
|TSYSERR||A system error has occurred during execution of this function.|
This subroutine is part of Base Operating System (BOS) subroutine.
The t_getinfo subroutine.
The t_open subroutine.
The t_rcvv subroutine.
The t_rcv subroutine.
The t_snd subroutine.