t_close()

NAME

t_close - close a transport endpoint

SYNOPSIS

#include <xti.h>

int t_close(
	int fd)

DESCRIPTION

The t_close(3) function 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. In addition, t_close(3) closes the file associated with the transport endpoint.

Parameters Before call After call
fd x /

The function t_close(3) should be called from the T_UNBND state (see t_getstate(3)). However, this function 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, close(3) will be issued for that file descriptor; if there are no other descriptors in this process or in another process which references the communication endpoint, any connection that may be associated with that endpoint is broken. The connection may be terminated in an orderly or abortive manner.

A t_close(3) 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 - apart from T_UNINIT

ERRORS

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

[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 error (t_errno).
[TSYSERR]
A system error has occurred during execution of this function.

RETURN VALUE

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and t_errno is set to indicate an error.

SEE ALSO

t_getstate(3)

t_open(3)

t_unbind(3)