Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>
int t_snd(int fd, char *buf, unsigned int nbytes, int flags);
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 (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 select/poll.
If successful, t_snd() returns the number of bytes accepted by the transport provider. Normally this will equal the number of bytes specified in nbytes. However, if O_NONBLOCK 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 return a value that is less than the value of nbytes.
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 disconnect) has occurred.
Valid states: T_DATAXFER
If successful, t_snd() returns the number of bytes accepted by the transport provider.
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.
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.