[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    t_rcvdis(3N) manual page Table of Contents

Name

t_rcvdis - retrieve information from disconnect

Synopsis

cc [ flag ... ] file ... -lnsl [ library ... ]

#include <tiuser.h>

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

MT-Level

MT-Safe

Description

This function is used to identify the cause of a disconnect, and to retrieve any user data sent with the disconnect. fildes identifies the local transport endpoint where the connection existed, and discon points to a t_discon structure containing the following members:

struct netbufudata;
intreason;
intsequence;

/* struct netbuf {
unsigned intmaxlen;
unsigned intlen;
char*buf;
};
*/

reason specifies the reason for the disconnect through a protocol-dependent reason code, udata identifies any user data that was sent with the disconnect, and sequence may identify an outstanding connect indication with which the disconnect is associated. sequence is only meaningful when t_rcvdis() is issued by a passive transport user who has executed one or more t_listen(3N) 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 NULL and any user data associated with the disconnect will be discarded. However, if a user has retrieved more than one outstanding connect indication (using t_listen(3N) ) and discon is NULL , the user will be unable to identify which connect indication the disconnect is associated with.

Return Values

t_rcvdis returns 0 on success. On failure t_rcvdis returns -1, t_errno is set to indicate the error, and possibly errno is set.

Errors

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

TBADF
The specified file descriptor does not refer to a transport endpoint.
TBUFOVFLW
The number of bytes allocated for incoming data is not sufficient to store the data. The provider’s state, as seen by the user, will change to T_IDLE , and the disconnect indication information to be returned in discon will be discarded.
TNODIS
No disconnect indication currently exists on the specified transport endpoint.
TNOTSUPPORT
This function is not supported by the underlying transport provider.
TSYSERR
A system error has occurred during execution of this function, errno will be set to the specific error.

See Also

t_connect(3N) , t_listen(3N) , t_open(3N) , t_snddis(3N)

Notes

This interface is safe in multithreaded applications.


Table of Contents