t_snd(3)t_snd(3)NAMEt_snd() - send data or expedited data over a connection
SYNOPSISDESCRIPTION
This function is used to send either normal or expedited data. 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, and flags specifies any optional flags described
below:
if set in flags, the data will be sent as expedited data and
will be subject to the interpretations of the trans‐
port provider.
if set in flags, this indicates to the transport provider that
the transport service data unit, TSDU (or expedited
transport service data unit - ETSDU), is being sent
through multiple calls. Each with the flag set indi‐
cates that another will follow with more data for the
current TSDU. The end of the TSDU (or ETSDU) is iden‐
tified by a call with the flag not set. Use of
enables a user to break up large logical 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 or the flag is not mean‐
ingful and should be ignored.
The sending of a zero-length fragment of a TSDU or ETSDU is only per‐
mitted where this is used to indicate the end of a TSDU or ETSDU, i.e.
when the flag is not set. Some transport providers also forbid zero-
length TSDUs and ETSDUs.
By default, operates in synchronous mode and may wait if flow control
restrictions prevent the data from being accepted by the local trans‐
port provider at the time the call is made. However, if is set (via or
will execute in asynchronous mode, and will fail immediately if there
are flow control restrictions. For XTI only, the process can arrange
to be informed when the flow control restrictions are cleared via
will wait if STREAMS internal resources are not available, even if is
set. non-blocking behavior applies only to flow control conditions.
On successful completion, returns the number of bytes accepted by the
transport provider. In synchronous mode, this will equal the number of
bytes specified in nbytes. However, if (asynchronous mode) is set, it
is possible that only part of the data will actually be accepted by the
transport provider. In this case, will set for the data that can be
accepted by the provider, and return a value that is less than the
value of nbytes.
If nbytes is zero and sending of zero octets is not supported by the
underlying transport service, will return −1 with set to [TBADDATA].
The size of each TSDU or ETSDU must not exceed the limits of the trans‐
port provider as returned in the TSDU or ETSDU fields of the info argu‐
ment of or Failure to comply will result in a protocol error. (See
[TSYSERR] below.)
For XTI only, the error [TLOOK] may be returned to inform the process
that an event (e.g., a disconnect) has occurred.
For TLI only, if the transport endpoint is in any state but or the
transport provider will set to [TSYSERR] and set the system to
[EPROTO].
Caveats
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 calls then the different data may be inter‐
mixed.
Multiple sends which exceed the maximum TSDU or ETSDU size may not be
discovered by XTI. In this case, an implementation-dependent error
will result (generated by the transport provider) perhaps on a subse‐
quent XTI call. This error may take the form of a connection abort,
[TSYSERR], [TBADDATA], or a [TPROTO].
If multiple sends which exceed the maximum TSDU or ETSDU size are
detected by XTI, fails with [TBADDATA].
Fork Safety
is not fork-safe.
RETURN VALUE
On successful completion, returns the number of bytes accepted by the
transport provider. Otherwise, −1 is returned on failure and is set to
indicate the error.
ERRORS
On failure, is set to one of the following:
[TBADF] The specified identifier does not refer to a trans‐
port endpoint.
[TBADDATA] Illegal amount of data:
A single send was attempted specifying a TSDU
(ETSDU) or fragment TSDU (ETSDU) greater than that
specified by the current values of the TSDU or
ETSDU fields in the info argument.
A send of zero byte TSDU (ETSDU) or zero byte frag‐
ment of TSDU (ETSDU) is not supported by the
provider.
Multiple sends were attempted resulting in a TSDU
(ETSDU) larger than that specified by the current
value of the TSDU or ETSDU fields in the info argu‐
ment. The ability of XTI to catch such an error
case is implementation-dependent.
[TBADFLAG] An invalid flag was specified.
[TFLOW] was set, but the flow control mechanism prevented
the transport provider from accepting all or part
of the data at this time.
[TLOOK] An asynchronous event has occurred on this trans‐
port endpoint and requires immediate attention.
[TNOTSUPPORT] This function is not supported by the underlying
transport provider.
[TOUTSTATE] The function was issued in the wrong sequence on
the endpoint referenced by fd.
[TSYSERR] A system error has occurred during execution of
this function.
[TPROTO] (XTI only) This error indicates that a communica‐
tion problem has been detected between XTI and the
transport provider for which there is no other
suitable XTI (
SEE ALSOt_getinfo(3), t_open(3), t_rcv(3), thread_safety(5).
STANDARDS CONFORMANCEt_snd(3)