Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ t_snd(3) — Macintosh Execution Environment 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

t_getinfo(3)

t_open(3)

t_rcv(3)

t_snd(3)

NAME

t_snd − send data or expedited data over a connection

SYNOPSIS

#include <xti.h>     (for XTI)

or

#include <tiuser.h>  (for 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(3) or t_getinfo (3), the T_MORE flag is not meaningful and should be ignored. 

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 or O_NDELAY is set (via t_open(3) or fcntl (2)), 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(3). 

t_snd will wait if STREAMS internal resources are not available, even if O_NONBLOCK or O_NDELAY is set.  O_NONBLOCK and O_NDELAY 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 or O_NDELAY (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(3) 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(3) or t_getinfo(3).  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]. 

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 -- zero octets is not supported. 

­[TBADFLAG] (XTI only) An invalid flag was specified. 

­[TFLOW] O_NONBLOCK or O_NDELAY was set, but the flow control mechanism prevented the transport provider from accepting all or part of the data at this time. 

­[TLOOK] (XTI only) 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] (XTI only) 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. 

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. 
 

NOTE

For portability purposes, it is recommended that O_NONBLOCK be used instead of O_NDELAY. 

In HP-UX 9.0, XTI (X/Open Transport Interface) supports only OSI as a transport provider, and is available only as part of the OSI Transport Services 9000 product. Users of this product can access XTI versions of the t_* routines by linking with /usr/lib/libxti.a.  For more information on XTI, see "HP-UX/9000 XTI Programmer’s Guide". 

In HP-UX 9.0, TLI (Transport Layer Interface) supports any transport provider which is compliant with TPI (Transport Provider Interface).  TLI is available only as part of the STREAMS product.  Users of this product can access TLI versions of the t_* routines by linking with /usr/lib/libnsl_s.a.  For more information on TLI, see the TLI section of "STREAMS/UX for HP 9000 Reference Manual". 

SEE ALSO

t_getinfo(3), t_open(3), t_rcv(3). 

Hewlett-Packard Company  —  HP-UX Release 9.0: October 1992

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