t_close() — Close a transport endpoint

Standards

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

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <xti.h>

int t_close(int fd);

General description

Informs the transport provider that the user is finished with the transport endpoint specified by fd, and frees any local library resources associated with the endpoint. t_close() also closes the file associated with the transport endpoint.

t_close() should be called from the T_UNBND state. However, t_close() does not check state information, so it may be called from any state to close a transport endpoint. If this occurs, the local library resources associated with the endpoint are freed automatically. In addition, close() is issued for that file descriptor. The close() will be abortive if there are no other descriptors in this, or in another process which references the transport endpoint, and in this case will break any transport connection that may be associated with that endpoint.

A t_close() issued on a connection endpoint may cause data previously sent, or data not yet received, to be lost. It is the responsibility of the transport user to ensure that data is received by the remote peer.

Valid states: All - except for T_UNINIT

Returned value

If successful, t_close() returns 0.

If unsuccessful, t_close() 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.
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).

Related information