Listen for a connect indication.
X/Open Transport Interface Library (libxti.a)
#include <xti.h>
int t_listen (fd, call)
int fd;
struct t_call *call;
The t_listen subroutine listens for a connect request from a calling transport user.
By default, the t_listen subroutine executes in synchronous mode and waits for a connect indication to arrive before returning to the user. However, if O_NONBLOCK is set via the t_open subroutine or with the fcntl subroutine (F_SETFL), the t_listen subroutine executes asynchronously, reducing to a poll for existing connect indications. If none are available, the subroutine returns -1 and sets t_errno to TNODATA.
Some transport providers do not differentiate between a connect indication and the connection itself. If this is the case, a successful return of t_listen indicates an existing connection (see Appendix B, Internet Protocol-specific Information).
Item | Description |
---|---|
fd | Identifies the local transport endpoint where connect indications arrive. |
call | Contains information describing the connect indication. The
parameter call points to a t_call structure which contains
the following members:
In this structure, the fields have the following meanings:
Since this subroutine returns values for the addr, opt and udata fields of the call parameter, the maxlen field of each must be set before issuing the t_listen subroutine to indicate the maximum size of the buffer for each. |
T_IDLE, T_INCON.
Item | Description |
---|---|
0 | Successful completion. |
-1 | t_errno is set to indicate an error. |
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. |
TBADQLEN | The qlen parameter of the endpoint referenced by the fd parameter is zero. |
TBODATA | O_NONBLOCK was set, but no connect indications had been queued. |
TBUFOVFLW | The number of bytes allocated for an incoming parameter (maxlen) is greater than 0 but not sufficient to store the value of that parameter. The provider's state, as seen by the user, changes to T_INCON, and the connect indication information to be returned in the call parameter is discarded. The value of the sequence parameter returned can be used to do a t_snddis. |
TLOOK | An asynchronous event has occurred on the transport endpoint and requires immediate attention. |
TNOTSUPPORT | This subroutine is not supported by the underlying transport provider. |
TOUTSTATE | The subroutine was issued in the wrong sequence on the transport endpoint referenced by the fd parameter. |
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). |
TQFULL | The maximum number of outstanding indications has been reached for the endpoint referenced by the fd parameter. |
TSYSERR | A system error has occurred during execution of this subroutine. |