HP-UX Reference (11i v2 04/09) - 3 Library Functions N-Z (vol 7)

t
t_snd(3) t_snd(3)
NAME
t_snd() - send data or expedited data over a connection
SYNOPSIS
#include <xti.h> /* for X/OPEN Transport Interface - XTI */
/* or */
#include <tiuser.h> /* for Transport Layer Interface - TLI */
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 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:
T_EXPEDITED if set in flags, the data will be sent as expedited data and will be subject to the
interpretations of the transport provider.
T_MORE 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 t_snd() calls. Each t_snd() with the T_MORE flag set indicates that
another t_snd() will follow with more data for the current TSDU. The end of the
TSDU (or ETSDU) is identified by a t_snd() call with the T_MORE flag not set. Use
of T_MORE enables a user to break up large logical data units without losing the boun-
daries 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 t_open() or t_getinfo(), the T_MORE flag is not meaningful and
should be ignored.
The sending of a zero-length fragment of a TSDU or ETSDU is only permitted where this is used to indi-
cate the end of a TSDU or ETSDU, i.e. when the
T_MORE flag is not set. Some transport providers also
forbid zero-length TSDUs and ETSDUs.
By default,
t_snd() operates in synchronous mode and may wait if flow control restrictions prevent the
data from being accepted by the local transport provider at the time the call is made. However, if
O_NONBLOCK is set (via t_open() or fcntl()), t_snd() 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 t_look().
t_snd() will wait if STREAMS internal resources are not available, even if O_NONBLOCK is set.
O_NONBLOCK non-blocking behavior applies only to flow control conditions.
On successful completion,
t_snd() 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 O_NONBLOCK
(asynchronous mode) is set, it is possible that only part of the data will actually be accepted by the tran-
sport provider. In this case, t_snd() will set T_MORE 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,
t_snd()
will return 1 with t_errno set to [TBADDATA].
The size of each TSDU or ETSDU must not exceed the limits of the transport provider as returned in the
TSDU or ETSDU fields of the info argument of
t_open() or t_getinfo(). 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
T_DATAXFER or T_INREL, the transport pro-
vider will set t_errno to [TSYSERR] and set the system errno to [EPROTO].
HP-UX 11i Version 2: September 2004 1 Hewlett-Packard Company Section 31087