T_SND(3N)

NAME
t_snd - send normal or expedited data over a connection

SYNOPSIS

#include <tiuser.h>

int t_snd(fd, buf, nbytes, flags)
int fd;
char *buf;
unsigned nbytes;
int flags;

DESCRIPTION

t_snd() sends 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 user data bytes to be sent, and flags specifies any optional flags described below.

By default, t_snd() operates synchronously and may wait if flow control restrictions prevents data acceptance by the local transport provider when the call is made. However, if O_NDELAY is set (using t_open(3N) or fcntl()), t_snd() executes asynchronously, and fails immediately if there are flow control restrictions.

On success, t_snd() returns the byte total accepted by the transport provider. This normally equals the bytes total specified in nbytes. If O_NDELAY is set, it is possible that the transport provider will accept only part of the data. In this case, t_snd() will set T_MORE 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 provider; t_snd() returns zero.

If T_EXPEDITED is set in flags, the data is sent as expedited data, subject to the interpretations of the transport provider.

T_MORE 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. In these calls, the T_MORE flag indicates another t_snd() is to follow; the end of TSDU (or ETSDU) is identified by a t_snd() call without the T_MORE flag. T_MORE allows the sender to break up large logical data units, while preserving their boundaries at the other end. The flag does not imply 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(3N) or t_getinfo(3N), the T_MORE flag is meaningless.

The size of each TSDU or ETSDU must not exceed the transport provider limits as returned by t_open(3N) or t_getinfo(3N). Failure to comply results in protocol error EPROTO. See TSYSERR below.

If t_snd() is issued from the T_IDLE state, the provider may silently discard the data. If t_snd() is issued from any state other than T_DATAXFER or T_IDLE the provider generates a EPROTO error.

RETURN VALUES

On success, t_snd() returns the number of bytes accepted by the transport provider. On failure, it returns -1 and sets t_errno to indicate the error.

ERRORS

TBADF
    The specified file descriptor does not refer to a transport endpoint.

TFLOW
    O_NDELAY was set, but the flow control mechanism prevented the transport provider from accepting data at this time.

TNOTSUPPORT
    This function is not supported by the underlying transport provider.

TSYSERR
    The function failed due to a system error and set errno to indicate the error.

SEE ALSO
t_open(3N), t_rcv(3N)