t_snd(S) (TLI/XTI) 6 January 1993 t_snd(S) Name t_snd - send data or expedited data over a connection Syntax TLI syntax cc . . . -lnsls #include <sys/tiuser.h> int t_snd (fd, buf, nbytes, flags) int fd; char *buf; unsigned nbytes; int flags; XTI syntax cc . . . -lxti #include <xti.h> int t_snd (fd, buf, nbytes, flags) int fd; char *buf; unsigned nbytes; int flags; Description This function is used to send either normal or expedited data. fd iden- tifies 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, and flags specifies any optional flags described below. By default, tsnd operates in synchronous mode and may wait if flow con- trol restrictions prevent the data from being accepted by the local transport provider at the time the call is made. However, if ONONBLOCK is set (via topen or fcntl), tsnd executes in asynchronous mode, and fails immediately if there are flow control restrictions. Even when there are no flow control restrictions, tsnd waits if STREAMS internal resources are not available, regardless of the state of ONONBLOCK. On successful completion, tsnd returns the number of bytes accepted by the transport provider. Normally this equals the number of bytes speci- fied in nbytes. However, if ONONBLOCK is set, it is possible that only part of the data is accepted by the transport provider. In this case, tsnd sets TMORE for the data that was sent (see below) and returns a value less than nbytes. If nbytes is zero, no data is passed to the pro- vider and tsnd returns zero. If TEXPEDITED is set in flags, the data is sent as expedited data, and is subject to the interpretations of the transport provider. If TMORE is set in flags, or is set as described above, an indication is sent to the transport provider that the transport service data unit (TSDU) or expedited transport service data unit (ETSDU) is being sent through multiple tsnd calls. Each tsnd with the TMORE flag set indi- cates that another tsnd follows with more data for the current TSDU. The end of the TSDU (or ETSDU) is identified by a tsnd call with the TMORE flag not set. Use of TMORE enables a user to break up large log- ical data units without losing the boundaries of those units at the other end of the connection. The flag implies nothing about how the data is packaged for transfer below the transport interface. If the transport provider does not support the concept of a TSDU as indicated in the info argument on return from topen or tgetinfo, the TMORE flag is not mean- ingful and should be ignored. The size of each TSDU or ETSDU must not exceed the limits of the trans- port provider as returned by topen or tgetinfo. If the size is exceeded, a TSYSERR with system error EPROTO occurs. However, the tsnd may not fail because EPROTO errors may not be reported immediately. In this case, a subsequent call that accesses the transport endpoint fails with the associated TSYSERR. If tsnd is issued from the TIDLE state, the provider may silently dis- card the data. If tsnd is issued from any state other than TDATAXFER, TINREL or TIDLE, the provider generates a TSYSERR with system error EPROTO (which may be reported in the manner described above). Return value On successful completion, tsnd returns the number of bytes accepted by the transport provider, and it returns -1 on failure and terrno is set to indicate the error. Diagnostics On failure, terrno may be set to one of the following: [TBADDATA] Bad data was encountered with flags set to TEXPEDITED. [TBADF] The specified file descriptor does not refer to a transport endpoint. [TFLOW] ONONBLOCK was set, but the flow control mechanism prevented the transport provider from accepting data at this time. [TBADFLAG] The flags argument must be either TEND, TEXPEDITED, TMORE, or TEXPEDITED Or'ed with TMORE. [TLOOK] A disconnect or an orderly release request is occur- ring on the transport endpoint. [TNOTSUPPORT] The use of the TCLTS service type is not supported by the underlying transport provider. [TOUTSTATE] The function was issued in the wrong sequence on the transport endpoint referenced by fd [TSYSERR] A system error occurred during execution of this function. See also topen(S), trcv(S), Standards conformance tsnd is conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2).