Previous section.

Technical Standard: Networking Services (XNS), Issue 5.2 Draft 2.0
Copyright © 1999 The Open Group

NAME

t_close - close a transport endpoint

SYNOPSIS


#include <xti.h>

int t_close(int fd);


DESCRIPTION






Parameters Before call After call

fd x /


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

The function t_close() should be called from the T_UNBND state (see t_getstate()). 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() 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() 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.

For advice on how to write protocol-independent applications, see Writing Protocol-independent Software. For information on protocol-specific behaviour of t_close(), see the XTI Appendix for the relevant transport provider.

VALID STATES

ALL - apart from T_UNINIT

ERRORS

On failure, t_errno is set to the following:

[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(), t_open(), t_unbind().

CHANGE HISTORY

Issue 4

The SYNOPSIS section is placed in the form of a standard C function prototype.

Contents Next section Index