|
Description
The transport user can call the t_rcvconnect() function to determine the status of a connection that was previously requested with t_connect() in asynchronous mode. In asynchronous mode, t_rcvconnect() is used in conjunction with t_connect() to set up a connection. The connection is set up after successful execution of t_rcvconnect().
The fd parameter specifies the local transport endpoint on which the connection, which was previously requested with t_connect(), is to be set up. The call parameter points to an object of type struct t_call in which t_rcvconnect() returns information about the connection which was previously requested with t_connect().
The t_call structure is declared in <xti.h> as follows:
struct t_call { struct netbuf addr; struct netbuf opt; struct netbuf udata; int sequence; };
t_rcvconnect() returns the protocol address of the replying transport endpoint in call->addr.
Returning protocol-specific information or user data in call->udata is not supported by the transport provider.
call->sequence is meaningless for the t_rcvconnect() function.
Before calling t_rcvconnect(), the user must supply the maxlen component in the separate netbuf structures of *call with the appropriate maximum buffer sizes.
The null pointer can also be passed as the current parameter for call. In this case, t_rcvconnect() does not return any information to the user.
By default, t_rcvconnect() works in synchronous mode, waits for confirmation of a connection previously requested with t_connect() and only returns control to the calling transport user after receiving the confirmation. After t_rcvconnect() is executed, call->addr contains the valid information about the connection that was just set up.
However, if the user previously set O_NDELAY or O_NONBLOCK with t_open() or the POSIX fcntl() function, t_rcvconnect() works in asynchronous mode. t_rcvconnect() then does not wait for connection confirmation, but returns control immediately to the calling user after getting the status of the connection request. If the requested connection is not set up yet, t_rcvconnect() returns the value -1 and sets t_errno to TNODATA. In this case, the user must call t_rcvconnect() again at a later time to complete the connection setup phase and receive the relevant information in call->addr.
Return value
0:
If successful.
-1:
If an error occurs. t_ errno is set to indicate the error.
Errors
TBADF
The specified file descriptor does not reference a transport endpoint.
TBUFOVFLW
The number of bytes reserved for a result parameter is not enough to store the value of the parameter. The state of the transport provider is set to T_DATAXFER from the viewpoint of the user and the information for the connection request that should be returned in *call is removed.
TLOOK
An asynchronous event occurred on the transport endpoint passed in fd and this must be processed immediately.
TNODATA
O_NDELAY or O_NONBLOCK was set but no connection confirmation has arrived yet.
TNOTSUPPORT
This function is not supported by the underlying transport provider.
TOUTSTATE
The function was called in the wrong position within a sequence of XTI function calls for transport endpoint fd.
TSYSERR
A system error occurred during execution of this function.
See also
t_accept(), t_bind(), t_connect(), t_listen(), t_open(), fcntl()