t_close Subroutine for X/Open Transport Interface

Purpose

Close a transport endpoint.

Library

X/Open Transport Interface Library (libxti.a)

Syntax

#include <xti.h>
int t_close (fd)
int fd;

Description

The t_close subroutine informs the transport provider that the user is finished with the transport endpoint specified by the fd parameter and frees any local library resources associated with the endpoint. In addition, the t_close subroutine closes the file associated with the transport endpoint.

The t_close subroutine should be called from the T_UNBND state (see the t_getstate subroutine). However, this subroutine 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 will be freed automatically. In addition, the close subroutine is issued for that file descriptor. The close subroutine is abortive if there are no other descriptors in this process or if there are no other descriptors 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 subroutine 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.

Parameter

Item Description
fd Specfies the transport endpoint to be closed.

Valid States

ALL - apart from T_UNINIT.

Return Values

Item Description
0 Successful completion.
-1 t_errno is set to indicate an error.

Errors

On failure, t_errno is set to one of the following:

Value 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 the X/Open Transport Interface and the transport provider for which there is no other suitable X/Open Transport Interface (t_errno).