Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > T

t_snd(3)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 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 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 indicate 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 transport 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 provider will set t_errno to [TSYSERR] and set the system errno 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 t_snd() calls then the different data may be intermixed.

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 subsequent 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, t_snd() fails with [TBADDATA].

Fork Safety

t_snd is not fork-safe.

RETURN VALUE

On successful completion, t_snd() returns the number of bytes accepted by the transport provider. Otherwise, -1 is returned on failure and t_errno is set to indicate the error.

ERRORS

On failure, t_errno is set to one of the following:

[TBADF]

The specified identifier does not refer to a transport 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 fragment 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 argument. The ability of XTI to catch such an error case is implementation-dependent.

[TBADFLAG]

An invalid flag was specified.

[TFLOW]

O_NONBLOCK 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 transport 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 communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI ( t_errno).

STANDARDS CONFORMANCE

t_snd(): SVID2, XPG3, XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.