Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ t_snd(3N) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

t_getinfo(3N)

t_open(3N)

t_rcv(3N)

attributes(5)

t_snd(3N)

NAME

t_snd − send data or expedited data over a connection

SYNOPSIS

cc [ flag ... ] file ... −lnsl [ library ... ]

#include <xti.h>

int t_snd(int fd, void ∗buf, unsigned int nbytes, int flags);

DESCRIPTION

This routine is part of the XTI interfaces which evolved from the TLI interfaces.  XTI represents the future evolution of these interfaces.  However, TLI interfaces are supported for compatibility. When using a TLI routine that has the same name as an XTI routine, a different header file, tiuser.h , must be used.  Refer to the section, TLI COMPATIBILITY , for a description of differences between the two interfaces. 

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 can be specified using bitwise- OR operations with the following values. 

T_EXPEDITED Send the data as expedited data. This will be subject to the interpretations of the transport provider. 

T_MORE Send an indication 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 or (ETSDU).  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 (3N) or t_getinfo(3N), the T_MORE flag is not meaningful and will be ignored if set. 

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 ; that is, when the T_MORE flag is not set. Some transport providers also forbid zero-length TSDU s and ETSDU s.

T_PUSH Tells the communication provider to flush all data that is currently in its send buffers.  If not set in flags, the behaviour is protocol-specific. 

Note: The communications provider is free to collect data in a send buffer until it accumulates as sufficient amount for transmission. 

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 was set using t_open() or fcntl(), t_snd() will execute in asynchronous mode, and will fail immediately if there are flow control restrictions. 

The process can arrange to be informed when the flow control restrictions are cleared using either t_look() or the event management ( EM ) interface, possibly through poll() (see poll(2)). 

On successful completion, t_snd() returns the number of octets accepted by the transport provider.  Normally this will equal the number of bytes specified in nbytes. However, if O_NONBLOCK is set or the function is interrupted by a signal, it is possible that only part of the data has actually been accepted by the transport provider.  In this case, t_snd() will set T_MORE for the data that was sent (see below) and will return a value that is less than the value of nbytes.

If t_snd() is interrupted by a signal before it could transfer data to the communications provider, it returns −1 with t_errno set to TSYSERR and errno set to EINTR .

If nbytes is zero and sending of zero bytes is not supported by the underlying communications 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 specified by the current values in the TSDU or ETSDU fields in the info argument returned by t_getinfo(). 

The error TLOOK may be returned to inform the process that an event (for example, a disconnection) has occurred. 

VALID STATES

Legitimate states (see t_getstate(3N)) for a call to this routine are:

T_DATAXFER

T_INREL

RETURN VALUES

t_snd() returns:

number of bytes accepted by
the transport provider

On success. 

−1 On failure. 

On failure, t_errno is set to indicate the error, and possibly errno is set. 

Note: If the number of bytes accepted by the communications provider is less than the number of bytes requested, this may either indicate that O_NONBLOCK is set and the communications provider is blocked due to flow control, or that O_NONBLOCK is clear and the function was interrupted by a signal. 

ERRORS

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

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 a zero byte TSDU ( ETSDU ) or zero byte fragment of a TSDU ( ETSDU ) is not supported by 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 an XTI implementation to detect such an error case is implementation-dependent (see NOTES). 

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

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. 

TLOOK An asynchronous event has occurred on this transport endpoint. 

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

TOUTSTATE The communications endpoint referenced by fd or resfd is not in one of the states in which a call to this function is valid. 

TPROTO 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 value. 

TSYSERR A system error (see intro(2)) has occurred during execution of this function.

TLI COMPATIBILITY

The XTI and TLI interface definitions have common names but use different header files.  This, and other semantic differences between the two interfaces are described in the subsections below. 

Interface Header

The XTI interfaces use the header file, xti.h .  TLI interfaces should not use this header.  They should use the header:

#include <tiuser.h>

Error Description Values

The t_errno values that can be set by the XTI interface and cannot be set by the TLI interface are:

TPROTO

TLOOK

TBADFLAG

TOUTSTATE

The t_errno values that this routine can return under different circumstances than its XTI counterpart are:

TBADDATA
In the TBADDATA error cases described above, TBADDATA is returned, only for illegal zero byte TSDU ( ETSDU ) send attempts.

For more information refer to the Transport Interfaces Programming Guide. 

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level MT-Safe

SEE ALSO

fcntl(2), t_getinfo(3N), t_open(3N), t_rcv(3N), attributes(5)

Transport Interfaces Programming Guide

NOTES

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, a TSYSERR , a TBADDATA or a TPROTO error. 

If multiple sends which exceed the maximum TSDU or ETSDU size are detected by XTI , t_snd() fails with TBADDATA .

SunOS 5.6  —  Last change: 10 Feb 1997

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026