t_listen -- listen for a connect request


TLI syntax

cc . . . -lnsl

#include <sys/tiuser.h>

int t_listen (fd, call) int fd; struct t_call *call;

XTI syntax

cc . . . -lxti

#include <xti.h>

int t_listen (fd, call) int fd; struct t_call *call;


The t_listen 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;
   struct netbuf opt;
   struct netbuf udata;
   int sequence;
netbuf is described in netbuf(FP). 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 netbuf(FP)) 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 (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.

Return values

t_listen returns 0 on success and -1 on failure, and t_errno is set to indicate the error.


On failure, t_errno may be set to one of the following:

The specified file descriptor does not refer to a transport endpoint.

The number of outstanding connect indications is equal to qlen; XTI only.

The number of bytes allocated for an incoming argument is not 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.

An asynchronous event has occurred on this transport endpoint and requires immediate attention.

O_NONBLOCK was set, but no connect indications had been queued.

This function is not supported by the underlying transport provider.

The function was called out with sequence; XTI only.

A system error occurred during execution of this function. errno may have any of the following values:

The area specified in the t_call structure is not (or not completely) located in the user address space.

The transport provider is no longer operable.

A protocol error occurred.


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 waits forever because no connect indications arrive on that endpoint.

See also

Intro(NET), netbuf(FP), t_accept(NET), t_bind(NET), t_connect(NET), t_open(NET), t_rcvconnect(NET)

Standards conformance

t_listen is conformant with:

AT&T SVID Issue 3 ;
X/Open CAE Specification, Networking Services, Issue 4, 1994. ;
and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2)

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003