t_listen(3N)
t_listen - listen for a connect request
As shipped in IRIX 6.5.5. Unchanged since IRIX 6.5.
NAME t_listen - listen for a connect request SYNOPSIS #ifdef _XOPEN_SOURCE #include <xti.h> #else #include <tiuser.h> #endif int t_listen(fd, call) int fd; struct t_call *call; DESCRIPTION This function listens for a connect request from a calling transport user. fd identifies the local transport endpoint where connect indications arrive, and on return, call contains information describing the connect indication. call points to a t_call structure, which contains the following members: struct netbuf addr; truct netbuf opt; struct netbuf udata; int sequence; netbuf is described in intro(3N). In call, addr returns the protocol address of the calling transport user, opt returns protocol-specific parameters associated with the connect request, udata returns any user data sent by the caller on the connect request, and 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 [see netbuf in intro(3N)] field of each must be set before issuing 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_NDELAY or O_NONBLOCK is set (via 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. This function resides within both the X/Open compliant libxnet and the SVR4 compliant libnsl Network Services libraries. Network Services applications which require X/Open compliance must link-load with -lxnet. Network Services applications which require SVR4 compliance must link- load with -lnsl. On failure, t_errno may be set to one of the following: TBADF The specified file descriptor does not refer to a transport endpoint. TBADQLEN If _XOPEN_SOURCE is defined, then when the argument qlen of the endpoint referenced by fd is zero, then this error will be returned in t_errno. TBUFOVFLW The number of bytes allocated for an incoming argument is not sufficient to store the value of that argument. If, however, _XOPEN_SOURCE is defined, then the previous statement is slightly changed to be: the number of bytes allocated for an incoming argument is greater than zero and sufficient to store the value of that argument. The provider's state, as seen by the user, changes to T_INCON, and the connect indication information to be returned in call is discarded. TNODATA O_NDELAY or O_NONBLOCK was set, but no connect indications had been queued. TLOOK An asynchronous event has occurred on this transport endpoint and requires immediate attention. TNOTSUPPORT This function is not supported by the underlying transport provider. TOUTSTATE If _XOPEN_SOURCE is defined, then when this function is issued in the wrong sequence on the transport endpoint referenced by fd the TOUTSTATE value is returned within t_errno. TSYSERR A system error has occurred during execution of this function. TQFULL If _XOPEN_SOURCE is defined, then when the maximum number of outstanding indications has been reached for the transport endpoint referenced by fd, the TQFULL value is returned within t_errno. NOTES If a user issues t_listen in synchronous mode on a transport endpoint that was not bound for listening (that is, qlen was zero on t_bind), the call will wait forever because no connect indications will arrive on that endpoint. SEE ALSO intro(3N), fcntl(2), t_accept(3N), t_alloc(3N), t_bind(3N), t_connect(3N), t_open(3N), t_optmgmt(3N) t_rcvconnect(3N) DIAGNOSTICS t_listen returns 0 on success and -1 on failure and t_errno is set to indicate the error.