[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Communications, Volume 2
t_snd Subroutine for X/Open Transport Interface
Purpose
Send data or expedited data over a connection.
Library
X/Open Transport Interface Library (libxti.a)
Syntax
#include <xti.h>
int t_snd (
int fd,
void *buf,
unsigned int nbytes,
int *flags)
Description
The t_snd subroutine is used
to send either normal or expedited data. By default, the t_snd subroutine operates in synchronous mode and may wait if flow control
restrictions prevents the data from being accepted by the local transport
provider at the time the call is made. However, if O_NONBLOCK is set (via the t_open subroutine or fcntl), the t_snd subroutine executes in asynchronous
mode, and fails immediately if there are flow control restrictions. The process
can arrange to be informed when the flow control restrictions are cleared
via either the t_look subroutine or the Event Management
interface.
On successful completion, the t_snd subroutine returns the number of bytes accepted by the transport provider.
Normally this equals the number of bytes specified in the nbytes parameter. However, if O_NONBLOCK is set,
it is possible that only part of the data is actually accepted by the transport
provider. In this case, the t_snd subroutine returns
a value that is less than the value of the nbytes
parameter. If the value of the nbytes parameter is
zero and sending of zero octets is not supported by the underlying transport
service, the t_snd subroutine returns -1 with t_errno set to TBADDATA.
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 the X/Open Transport Interface. 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 the X/Open Transport Interface, t_snd fails
with TBADDATA.
Parameters
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. |
flags |
Specifies any optional flags described below:
- T_EXPEDITED
- If set in the flags parameter, the data is
sent as expedited data and is subject to the interpretations of the transport
provider.
- T_MORE
- If set in the flags parameter, 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 call with the T_MORE flag set indicates that another t_snd call
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 parameter on return from
the t_open or t_getinfo subroutines,
the T_MORE flag is not meaningful and is 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, for example, when the T_MORE flag is
not set. Some transport providers also forbid zero-length TSDUs and ETSDUs.
See Appendix A, ISO Transport Protocol Information for a fuller explanation.
|
Valid States
T_DATAXFER, T_INREL.
Return Values
On successful completion, the t_snd subroutine 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, that in asynchronous mode, if the number of
bytes accepted by the transport provider is less than the number of bytes
requested, this may indicate that the transport provider is blocked due to
flow control.
Error Codes
On failure, t_errno is set to
one of the following:
Value |
Description |
TBADF |
The specified file descriptor 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 a zero byte TSDU (ETSDU) or zero byte fragment
of a TSDU (ETSDU) is not supported by the provider (see Appendix A, ISO Transport
Protocol Information) .
- 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
"Implementation Specifics".
|
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. |
TNOTSUPPORT |
This subroutine is not supported by the underlying transport provider. |
TLOOK |
An asynchronous event has occurred on this transport endpoint. |
TOUTSTATE |
The subroutine was issued in the wrong sequence on the transport
endpoint referenced by the fd parameter. |
TSYSERR |
A system error has occurred during execution of this subroutine. |
TPROTO |
This error indicates that a communication problem has been detected
between the X/Open Transport Interface and the transport provider for which there is no
other suitable X/Open Transport Interface (t_errno). |
Related Information
The t_getinfo subroutine, t_open
subroutine, t_rcv subroutine.
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]