t_snd(3xti)t_snd(3xti)Namet_snd - send data or expedited data over a connection
Syntax
#include <xti.h>
int t_snd(fd, buf, nbytes, flags)
int fd;
char *buf;
unsigned nbytes;
int flags;
Arguments
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:
T_EXPEDITED If set in flags, the data is sent as expedited
data and is subject to the interpretations of
the transport provider.
T_MORE If set in flags, this indicates to the trans‐
port provider that the transport service data
unit (TSDU) or expedited transport service data
unit (ETSDU) is being sent through multiple
calls. Each with the T_MORE flag set indicates
that another follows with more data for the
current TSDU. The end of TSDU or ETSDU is
identified by a call with the T_MORE flag not
set. Use of T_MORE enables a user to break up
large logical data units without losing bound‐
aries 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 indi‐
cated in the info argument on return from or
the T_MORE flag is not meaningful and should be
ignored.
Description
This function is used to send either normal or expedited data.
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 O_NONBLOCK is
set by means of or executes in asynchronous mode, and fails immedi‐
ately, if there are flow control restrictions. The process can arrange
to be informed when the flow control restrictions are cleared by means
of
On successful completion, returns the number of bytes accepted by the
transport provider. Normally, this equals the number of bytes specified
in nbytes. However, if O_NONBLOCK is set, it is possible that only part
of the data is accepted by the transport provider. In this case,
returns 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, the returns -1 with t_errno 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 results in protocol error (see [TSYSERR]
under the DIAGNOSTICS section).
The error [TLOOK] may be returned to inform the process that an event,
such as a disconnect, has occurred.
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.
──────────────────────────────────────
Parameters Before Call After Call
──────────────────────────────────────
fd x /
buf x(x) /
nbytes x /
flags x /
──────────────────────────────────────
Return Values
Upon successful completion, t_errno returns the number of bytes
accepted by the transport provider. On failure, a value of -1 is
returned, and t_errno is set to indicate the error.
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.
Diagnostics
On failure, t_errno is set to one of the following:
[TBADF] The specified file descriptor does not refer to a
transport endpoint.
[TOUTSTATE] The function was issued in the wrong sequence on
the transport endpoint referenced by fd.
[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.
[TBADDATA] Illegal amount of data: zero octets is not sup‐
ported.
[TLOOK] An asynchronous event has occurred on the transport
endpoint.
[TNOTSUPPORT] This function is not supported by the underlying
transport provider.
[TSYSERR] A system error has occurred during execution of
this function. A protocol error may not cause
t_errno to fail until a subsequent access of the
transport endpoint.
See Alsot_snd(3xti)