|
Description
The user can get the cause of a connection shutdown with the t_rcvdis() function.
The fd parameter specifies the local transport endpoint of the connection which was shut down.
The discon parameter points to an object of type struct t_discon.
The t_discon structure is declared in <xti.h> as follows:
struct t_discon { struct netbuf udata; int reason; int sequence; };
After execution of t_rcvdis(), discon->reason contains a protocol-dependent code which specifies the cause of the connection shutdown. This code corresponds to one of the possible values for the errno error variable (defined in <errno.h>). The following codes are currently possible:
ECONNREFUSED
The connection request was refused by the partner.
ECONNRESET
The connection was aborted by the partner.
ENETDOWN
The connection was aborted by the transport system. In this case, the user should close
the transport endpoint with t_close().
ETIMEDOUT
The connection could not be set up within a specific time.
The value returned in discon->sequence identifies a pending connection request which is associated with the connection setup. discon->sequence is only meaningful if the transport user that called the t_rcvdis() function previously called t_listen() one or more times to monitor socket fd for pending connection requests and is now processing these connection requests. When a connection shutdown request arrives, the user can check the value of discon->sequence to determine which of the pending connection requests is concerned.
Returning user data in discon->udata is not supported by the transport provider.
If the transport user is not interested in the returned values of discon->reason and discon->sequence, he can specify the null pointer as the current parameter for discon with the t_rcvdis() call.
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.
TNODIS
There is currently no connection shutdown request available on the specified transport endpoint.
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.