.\" @(#)t_rcvconnect.3n 1.11 90/02/15 SMI; from S5r3
.TH T_RCVCONNECT 3N "21 January 1990"
.SH NAME
t_rcvconnect \- receive the confirmation from a connect request
.SH SYNOPSIS
.LP
.nf
.ft B
#include <tiuser.h>
.ft
.fi
.LP
.nf
.ft B
int t_rcvconnect(fd, call)
int fd;
struct t_call *call;
.ft R
.fi
.SH DESCRIPTION
.IX t_rcvconnect() "" "\fLt_rcvconnect()\fR \(em receive confirmation from connect request"
.IX transport "receive confirmation from connect request"
.IX connect "receive confirmation from connect request"
.LP
.B t_rcvconnect
allows a calling transport user to get the status of a previous
connect request.
It can be used in conjunction with
.BR t_connect (3N)
to establish a connection in asynchronous mode.
.LP
.I fd
identifies the local transport endpoint where communication is
established.
.I call
contains information associated with the newly established connection
.I call
points to a
.I t_call
structure that contains information associated with the new
connection, and is defined in
.B <nettli/tiuser.h>
as:
.RS
.LP
.ft B
.nf
struct t_call {
	struct netbuf addr;
	struct netbuf opt;
	struct netbuf udata;
	int sequence;
};
.fi
.ft
.RE
.LP
The
.IR maxlen ,
.IR len ,
and
.I buf
members of the
.I netbuf
structure are described in
.BR t_accept (3N).
In the
.I t_call 
structure,
.I addr
returns the protocol address associated with the responding
transport endpoint,
.I opt
presents protocol-specific information associated with the connection,
.I udata
points to optional user data that may be returned by
the destination transport user during connection establishment,
and
.I sequence
has no meaning for this function.
.LP
The
.I maxlen
field of each argument
must be set before issuing this function to indicate the maximum
buffer size.
However,
.I call
may be
.SM NULL\s0,
in which case no information is given to
the user on return from
.BR t_rcvconnect(\|) .
By default,
.B t_rcvconnect(\|)
executes synchronously and
waits for the connection before returning.
On return, the
.IR addr ,
.IR opt ,
and
.I udata
fields reflect values associated with the connection.
.LP
If
.SB O_NDELAY
is set (using
.BR t_open (3N)
or
.BR fcntl(\|) ),
.B t_rcvconnect(\|)
executes asynchronously, 
reducing to a
.BR poll (2)
request for existing connect confirmations.
If none are available,
.B t_rcvconnect(\|)
fails and returns immediately
without waiting for the connection to be established.
See
.SB TNODATA
below.
.B t_rcvconnect(\|)
must be re-issued
at a later time to complete the connection establishment phase and
retrieve the information returned in
.IR call .
.SH RETURN VALUES
.LP
.B t_rcvconnect(\|)
returns:
.TP
0
on success.
.TP
\-1
on failure and sets
.B t_errno
to indicate the error.
.SH ERRORS
.TP 20
.SM TBADF
The specified file descriptor does not refer to a transport endpoint.
.TP
.SM TBUFOVFLW
The bytes allocated for an incoming argument is
sufficient to store the value of that argument
and the connect information to be returned in
.I call
is discarded.
The transport provider's state, as seen by the user, will be changed
to
.SM DATAXFER\s0.
.TP
.SM TNODATA
.SB O_NDELAY
was set, but a connect confirmation has not yet arrived.
.TP
.SM TLOOK
An asynchronous event has occurred on this transport connection and requires
immediate attention.
.TP
.SM TNOTSUPPORT
This function is not supported by the underlying transport
provider.
.TP
.SM TSYSERR
The function failed due to a system error and set 
.B errno 
to indicate the error.
.SH SEE ALSO
.BR poll (2),
.BR intro (3),
.BR t_accept (3N),
.BR t_bind (3N),
.BR t_connect (3N),
.BR t_listen (3N),
.BR t_open (3N)
.LP
.TX NETP
