t_rcvdis() — Retrieve information from disconnect

Standards

Standards / Extensions C or C++ Dependencies
XPG4.2 both  

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>

int t_rcvdis(int fd, struct t_discon *discon);

General description

Used to identify the cause of a disconnect. The argument fd identifies the local transport endpoint where the connection existed, and discon points to a t_discon structure containing the following members:
        struct netbuf   udata;
        int             reason;
        int             sequence;
The field reason specifies the reason for the disconnect through a protocol-dependent reason code, udata is always empty since the TCP transport provider does not support sending of user data with a disconnect, and sequence may identify an outstanding connect indication with which the disconnect is associated. The field sequence is only meaningful when t_rcvdis() is issued by a passive transport user who has executed one or more t_listen() functions and is processing the resulting connect indications. If a disconnect indication occurs, sequence can be used to identify which of the outstanding connect indications is associated with the disconnect.

If a user does not care if there is incoming data and does not need to know the value of reason or sequence, discon may be a NULL pointer. However, if a user has retrieved more than one outstanding connect indication (using t_listen() ) and discon is a NULL pointer, the user will be unable to identify with which connect indication the disconnect is associated.

Valid states: T_DATAXFER,T_OUTCON,T_INCON(ocnt > 0)

Returned value

If successful, t_rcvdis() returns 0.

If unsuccessful, t_rcvdis() returns -1 and sets errno to one of the following values:
Error Code
Description
TBADF
The specified file descriptor does not refer to a transport endpoint.
TBUFOVFLW
The number of bytes allocated for incoming data (maxlen) is greater than 0 but not sufficient to store the data. If fd is a passive endpoint with ocnt > 1, it remains in state T_INCON; otherwise, the endpoint state is set to T_IDLE.
TNODIS
No disconnect indication currently exists on the specified transport endpoint.
TNOTSUPPORT
This function is not supported by the underlying transport provider.
TOUTSTATE
The function was issued in the wrong sequence on the transport endpoint referenced by fd.
TPROTO
This error indicates that a communication problem has been detected between XTI and the transport provider for which there is no other suitable XTI (t_errno).
TSYSERR
A system error has occurred during execution of this function.

Related information