t_snd(3)t_snd(3)NAMEt_snd - Send normal data or expedited data over a connection
SYNOPSIS
#include <xti.h>
int t_snd(
int fd,
char *buf,
unsigned nbytes,
int flags );
LIBRARY
XTI Library (libxti.a)
STANDARDS
Interfaces documented on this reference page conform to industry stan‐
dards as follows:
t_snd(): XNS4.0, XNS5.0
Refer to the standards(5) reference page for more information about
industry standards and associated tags.
PARAMETERS
The following table summarizes the relevance of input and output param‐
eters before and after t_snd() is called:
──────────────────────────────────────
Parameters Before Call After Call
──────────────────────────────────────
fd y n
buf y(y) n
nbytes y n
flags y n
──────────────────────────────────────
Notes to Table: This is a meaningful parameter. This is not a meaning‐
ful parameter. The content of the object pointed to by y is meaning‐
ful. Specifies a file descriptor returned by the t_open() function
that identifies the local transport endpoint where an active connection
exists. Points to the data buffer from which data is to be sent.
Specifies the length in bytes of the send data buffer contents pointed
to by the buf parameter. Points to an integer whose bits specify cer‐
tain optional information. Corresponding values and symbolic names for
these option bits are defined in the xti.h include file. Flags speci‐
fied by this function are: When set, this bit notifies the transport
provider that sent data is a fragment of a Transport Service Data Unit
(TSDU) or Expedited Transport Service Data Unit (ETSDU), and that more
data will be sent on the same TSDU or ETSDU via the t_snd() function.
The rest of the TSDU or ETSDU can be sent through further t_snd() func‐
tion calls.
Each time the T_MORE option is set, another t_snd() call follows
so that additional parts of the TSDUs or ETSDUs can be sent.
When the final piece is sent, this option bit is set to a value
of 0 (zero). When the transport provider does not support TSDU
or ETSDU data exchanges (refer to the t_open() and t_getinfo()
functions) the state of this option bit is meaningless.
Sending 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, that is, when the T_MORE option is not set. Some trans‐
port providers also forbid zero-length TSDUs and ETSDUs. When
set, this bit notifies the transport provider that expedited
data is sent. When the value of ETSDU data exceeds the value
specified by nbytes parameter, this option bit and the T_MORE
option bit should be set prior to the initial t_snd() call. Sub‐
sequent t_snd() calls used to send pieces of ETSDU must have
both these option bits set. When the final ETSDU is sent, the
T_MORE option bit is set to a value of 0 (zero).
DESCRIPTION
The t_snd() function is an XTI connection-oriented service function
that is used to send normal or expedited data. The transport endpoint
through which normal Transport Service Data Unit (TSDU) data or special
Expedited TSDU (ETSDU) data is sent is specified by a file descriptor
previously returned by the t_open() function.
The size of each TSDU or ETSDU must not exceed the size limits speci‐
fied by info->tsdu or info->etsdu, respectively, returned by the
t_open() or t_getinfo() functions. Failure to comply with specified
size constraints results in return of a [TSYSERR] protocol error. By
default, the t_snd() function executes in the synchronous operating
mode. In the synchronous operating mode t_snd() waits for data to be
accepted by the transport provider, before returning control to the
calling transport user.
When the transport endpoint specified by the file descriptor has been
opened with the O_NONBLOCK flag set in the t_open() or fcntl() func‐
tion, the t_snd() function executes in asynchronous mode. When data
cannot be immediately accepted because flow control restrictions apply,
control is immediately returned to the caller.
When the t_snd() function executes successfully, the number of bytes
accepted by the transport provider is returned. It is possible that
only part of the data may be accepted by a transport provider. When
only partial data is accepted, the returned value is less than the num‐
ber of bytes sent. If the nbytes parameter is specified as 0 (zero),
and the underlying transport service does not support the sending of 0
octets, t_errno is set to [TBADDATA] and -1 is returned.
NOTES
In asynchronous mode, when the number of bytes accepted by the trans‐
port provider is less than the number of bytes sent, the transport
provider may be blocked because of flow-control restrictions.
The transport provider treats all users of a transport endpoint as a
single user. Therefore, if several processes issue concurrent t_snd()
calls, then the different data may be intermixed.
Multiple sends which exceed the maximum TSDU or ERSDU size may not be
discovered by XTI. In this case, an implementation-dependent error
will result, which may take the form of a connection abort, or a [TSY‐
SERR], [TBADDATA], or a [TPROTO] error.
If XTI detects multiple sends that exceed the maximum TSDU or ETSDU
size, t_snd() fails with the error [TBADDATA].
RETURN VALUES
Upon successful completion, the t_snd() function returns the number of
bytes of data accepted by the transport provider. Otherwise, -1 is
returned and t_errno is set to indicate the error.
ERRORS
If the t_snd() function fails, t_errno may be set to one of the follow‐
ing values: File descriptor fd does not refer to a valid transport end‐
point. Illegal amount of data: A single send was attempted specifying
a TSDU or ETSDU, or a fragment TSDU or ETSDU, greater than that speci‐
fied by the current values of the TSDU or ETSDU fields in the info
argument. A send of a zero-byte TSDU or ETSDU, or a zero-byte fragment
of a TSDU or ETSDU, is not supported by the provider. Multiple sends
were attempted, which resulted in a TSDU or ETSDU larger than that
specified by the current values of the TSDU or ETSDU fields in the info
argument. The ability to detect this error is implementation depen‐
dent. An invalid flags value was specified. Asynchronous mode is
indicated because O_NONBLOCK was set, but no data can currently be
accepted by the transport provider because of flow-control restric‐
tions. An asynchronous event occurred on this transport endpoint. The
t_snd() function was issued in the wrong sequence on the transport end‐
point referenced by the fd parameter. A system error occurred during
execution of the t_snd() function. A protocol error may not cause
t_snd() to fail until a subsequent access of the transport endpoint is
made. This function is not supported by the underlying transport
provider. This error indicates that a communication problem has been
detected between XTI and the transport provider for which there is no
other suitable XTI(t_errno).
VALID STATES
The t_snd() function can be called only in the T_DATAXFER and T_INREL
transport provider states.
SEE ALSO
Functions: fcntl(2), t_getinfo(3), t_look(3), t_open(3), t_optmgmt(3),
t_rcv(3)
Standards: standards(5)
Network Programmer's Guide
t_snd(3)