t_snd - send data or expedited data over a connection
#include <xti.h>
int t_snd(
int fd,
void *buf,
unsigned int nbytes,
int flags)
The t_snd() function is used to send either normal or expedited data.
Parameters | Before call | After call |
---|---|---|
fd | x | / |
buf | x (x) | = |
nbytes | x | / |
flags | x | / |
This function is used to send either normal or expedited data. The argument 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:
By default, t_snd(3) 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 (through t_open(3) or fcntl(3)), t_snd(3) 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 through either t_look(3) or the EM interface.
On successful completion, t_snd(3) returns the number of bytes (octets) accepted by the communications provider. Normally this will equal the number of octets 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 communications provider. In this case, t_snd(3) returns a value that is less than the value of nbytes. If t_snd(3) 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(3) returns -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(3).
The error [TLOOK] is returned for asynchronous events. It is required only for an incoming disconnect event but may be returned for other events.
T_DATAXFER, T_INREL
On failure, t_errno is set to one of the following:
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.
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.
t_getinfo(3)
t_open(3)
t_rcv(3)
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].