📄 t_sndv.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>t_sndv</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4>NAME</h4><blockquote>t_sndv - send data or expedited data, from one or morenon-contiguous buffers, on a connection</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="xti.h.html">xti.h</a>>int t_sndv( int fd, const struct t_iovec *iov, unsigned it iovcount, int flags)</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote><pre><P><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Parameters</b><th align=center><b>Before call</b><th align=center><b>After call</b><tr valign=top><td align=left>fd<td align=center>x<td align=center>/<tr valign=top><td align=left>iovec<td align=center>x<td align=center>/<tr valign=top><td align=left>iovcount<td align=center>x<td align=center>/<tr valign=top><td align=left>iov[0].iov_base<td align=center>x(x)<td align=center>=(=)<tr valign=top><td align=left>iov[0].iov_len<td align=center>x<td align=center>=<tr valign=top><td align=left> . . . .<tr valign=top><td align=left>iov[iovcount-1].iov_base<td align=center>x(x)<td align=center>=(=)<tr valign=top><td align=left>iov[iovcount-1].iov_len<td align=center>x<td align=center>=<tr valign=top><td align=left>flags<td align=center>x<td align=center>/</table></pre><p>This function is used to send either normal or expediteddata. The argument <I>fd</I>identifies the local transportendpoint over which data should be sent, <I>iov</I>points to anarray of buffer address/buffer length pairs. <i>t_sndv()</i>sends data contained in buffers <I>iov[0]</I>,<I>iov[1]</I>,through <I>iov[iovcount-1]</I>.<I>iovcount</I>contains the number ofnon-contiguous data buffers which is limited to T_IOV_MAX(an implementation-defined value of at least 16). If thelimit is exceeded, the function fails with [TBADDATA].<p><dl><dt><b>Note:</b><dd>The limit on the total number of bytes availablein all buffers passed (that is:<I>iov(0).iov_len + . . + iov(iovcount-1).iov_len</I>)may be constrained byimplementation limits. If no other constraint applies,it will be limited by [INT_MAX]. In practice, theavailability of memory to an application is likely toimpose a lower limit on the amount of data that can besent or received using scatter/gather functions.</dl><p>The argument <I>flags</I>specifies any optional flags described below:<dl compact><dt>T_EXPEDITED<dd><br>If set in<I>flags</I>,the data will be sent asexpedited data and will be subject to theinterpretations of the transport provider.<dt>T_MORE<dd><br>If set in <I>flags</I>,this indicates to thetransport provider that the transportservice data unit (TSDU) (or expeditedtransport service data unit - ETSDU) isbeing sent through multiple <i>t_sndv()</i>calls.Each <i>t_sndv()</i>with the T_MORE flag setindicates that another <i>t_sndv()</i>(or <i><a href="t_snd.html">t_snd()</a></i>)will follow with more data for the current TSDU (or ETSDU).The end of the TSDU (or ETSDU) is identifiedby a <i>t_sndv()</i>call with the T_MORE flag notset. Use of T_MORE enables a user to breakup large logical data units without losingthe boundaries of those units at the otherend of the connection. The flag impliesnothing about how the data is packaged fortransfer below the transport interface. Ifthe transport provider does not support theconcept of a TSDU as indicated in the <I>info</I>argument on return from <i><a href="t_open.html">t_open()</a></i>or<i><a href="t_getinfo.html">t_getinfo()</a></i>,the T_MORE flag is notmeaningful and will be ignored if set.The sending of a zero-length fragment of aTSDU or ETSDU is only permitted where thisis used to indicate the end of a TSDU orETSDU, that is, when the T_MORE flag is notset. Some transport providers also forbidzero-length TSDUs and ETSDUs. See <xref href=istpi></xref>for a fuller explanation.</dl>If set in <I>flags</I>, requests that the provider transmit all datathat it has accumulated but not sent. The request is a local actionon the provider and does not affect any similarly named protocolflag (for example, the TCP PUSH flag). This effect of settingthis flag is protocol-dependent, and it may be ignored entirelyby transport providers which do not support the use of this feature. <p><dl><dt><b>Note:</b><dd>The communications provider is free to collectdata in a send buffer until it accumulates a sufficientamount for transmission.</dl><p>By default, <i>t_sndv()</i>operates in synchronous mode and maywait if flow control restrictions prevent the data frombeing accepted by the local transport provider at the timethe call is made. However, if O_NONBLOCK is set (via<i><a href="t_open.html">t_open()</a></i>or <i><a href="fcntl.html">fcntl()</a></i>),<i>t_sndv()</i>executes in asynchronousmode, and will fail immediately if there are flow controlrestrictions. The process can arrange to be informed whenthe flow control restrictions are cleared via either<i><a href="t_look.html">t_look()</a></i>or the EM interface.<p>On successful completion, <i>t_sndv()</i>returns the number ofbytes accepted by the transport provider. Normally this willequal the total number of bytes to be sent, that is,<pre><code><I>(iov[0].iov_len + .. . . + iov[iovcount-1].iov_len)</I></code></pre><p>However, theinterface is constrained to send at most INT_MAX bytes in a singlesend. When <i>t_sndv()</i>has submitted INT_MAX (or lower constrained value, see the note above)bytes to the provider for a single call, this valueis returned to the user. However, ifO_NONBLOCK is set or the function is interrupted by a signal, itis possible that only part of the data has actually beenaccepted by the communications provider. In this case, <i>t_sndv()</i>returns a value that is less than the value of nbytes. If<i>t_sndv()</i>is interrupted by a signal before it could transfer datato the communications provider, it returns -1 with <I>t_errno</I>set to [TSYSERR] and <I>errno</I>set to [EINTR].<p>If the number of bytes of data in the <I>iov</I>array is zero and sendingof zero octets is not supported by the underlying transportservice, <i>t_sndv()</i>returns -1 with <I>t_errno</I>set to [TBADDATA].<p>The size of each TSDU or ETSDU must not exceed the limits ofthe transport provider as specified by the current values inthe TSDU or ETSDU fields in the <I>info</I>argument returned by<i><a href="t_getinfo.html">t_getinfo()</a></i>.<p>The error [TLOOK] is returned for asynchronous events. It is requiredonly for an incoming disconnect event but may be returned forother events.</blockquote><h4>VALID STATES</h4><blockquote>T_DATAXFER, T_INREL</blockquote><h4>ERRORS</h4><blockquote>On failure, <I>t_errno</I>is set to one of the following:<dl compact><dt>[TBADDATA]<dd>Illegal amount of data:<ul><li>A single send was attempted specifyinga TSDU (ETSDU) or fragment TSDU (ETSDU)greater than that specified by thecurrent values of the TSDU or ETSDUfields in the <I>info</I>argument.<li>A send of a zero byte TSDU (ETSDU) orzero byte fragment of a TSDU (ETSDU) isnot supported by the provider.<li>Multiple sends were attempted resultingin a TSDU (ETSDU) larger than thatspecified by the current value of theTSDU or ETSDU fields in the <I>info</I>argument - the ability of an XTIimplementation to detect such an errorcase is implementation-dependent (seeCAVEATS, below).<li><I>iovcount</I>is greater than T_IOV_MAX.</ul><dt>[TBADF]<dd>The specified file descriptor does not refer to a transport endpoint.<dt>[TBADFLAG]<dd>An invalid flag was specified.<dt>[TFLOW]<dd>O_NONBLOCK was set, but the flow controlmechanism prevented the transport providerfrom accepting any data at this time.<dt>[TLOOK]<dd>An asynchronous event has occurred on thistransport endpoint.<dt>[TNOTSUPPORT]<dd>This function is not supported by theunderlying transport provider.<dt>[TOUTSTATE]<dd>The communications endpoint referenced by<I>fd</I>is not in one of the states in which a call to this function is valid.<dt>[TPROTO]<dd>This error indicates that a communicationproblem has been detected between XTI andthe transport provider for which there is noother suitable XTI error<I>(t_errno)</I>.<dt>[TSYSERR]<dd>A system error has occurred during executionof this function.</dl></blockquote><h4>RETURN VALUES</h4><blockquote>On successful completion, <i>t_sndv()</i>returns the number ofbytes accepted by the transport provider. Otherwise, -1 isreturned on failure and <I>t_errno</I>is set to indicate the error.<p><dl><dt><b>Notes:</b><dd><ol><p><li>In synchronous mode, if more than INT_MAX bytes of dataare passed in the <I>iov</I>array, only the first INT_MAX bytes will bepassed to the provider.<p><li>If the number of bytes accepted by the communicationsprovider is less than the number of bytes requested, this mayeither indicate that O_NONBLOCK is set and the communicationsprovider is blocked due to flow control, or that O_NONBLOCK isclear and the function was interrupted by a signal.<p></ol></dl></blockquote><h4>SEE ALSO</h4><blockquote><i><a href="t_getinfo.html">t_getinfo()</a></i>,<i><a href="t_open.html">t_open()</a></i>,<i><a href="t_rcvv.html">t_rcvv()</a></i>,<i><a href="t_rcv.html">t_rcv()</a></i>,<i><a href="t_snd.html">t_snd()</a></i>.</blockquote><h4>CAVEATS</h4><blockquote>It is important to remember that the transport providertreats all users of a transport endpoint as a single user.Therefore if several processes issue concurrent <i>t_sndv()</i>or <i><a href="t_snd.html">t_snd()</a></i>calls, then the different data may be intermixed.<p>Multiple sends which exceed the maximum TSDU or ETSDU sizemay not be discovered by XTI. In this case animplementation-dependent error will result (generated by thetransport provider), perhaps on a subsequent XTI call. Thiserror may take the form of a connection abort, a [TSYSERR],a [TBADDATA] or a [TPROTO] error.<p>If multiple sends which exceed the maximum TSDU or ETSDUsize are detected by XTI, <i>t_sndv()</i>fails with [TBADDATA].</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -