United States-English |
|
|
HP-UX Reference > Tt_snd(3)HP-UX 11i Version 3: February 2007 |
|
NAMEt_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; DESCRIPTIONThis 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:
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]. CaveatsIt 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]. RETURN VALUEOn 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. ERRORSOn failure, t_errno is set to one of the following:
|
Printable version | ||
|