Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 | both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>
int t_listen(int fd, struct t_call *call);
struct netbuf addr;
struct netbuf opt;
struct netbuf udata;
int sequence;
In call, addr returns
the protocol address of the calling transport user. This address is
in a format usable in future calls to t_connect(). However, t_connect()
may fail for other reasons; For example TADDRBUSY. opt returns
options associated with the connect request. udata is meaningless
because transmission of user data is not supported across a connect
request. sequence is a number that uniquely identifies the
returned connect indication. The value of sequence enables the user
to listen for multiple connect indications before responding to any
of them.Since this function returns values for the addr, opt and udata fields of call, the maxlen field of each must be set before issuing the t_listen() to indicate the maximum size of the buffer for each.
By default, t_listen() executes in synchronous mode and waits for a connect indication to arrive before returning to the user. However, if O_NONBLOCK is set using t_open() or fcntl(), t_listen() executes asynchronously, reducing to a poll for existing connect indications. If none are available, it returns -1 and sets t_errno to TNODATA.
Valid states: T_IDLE, T_INCON
If successful, t_listen() returns 0. The TCP transport provider does not differentiate between a connect indication and the connection itself. A successful return of t_listen() indicates an existing connection.