PURPOSE

tpdiscon - routine for taking down a conversational service connection

SYNOPSIS

#include <atmi.h>
int tpdiscon(int cd)

DESCRIPTION

tpdiscon() immediately tears down the connection specified by cd and generates a TPEV_DISCONIMM event on the other end of the connection.

tpdiscon() can be called only by the initiator of the conversation. tpdiscon() cannot be called within a conversational service on the descriptor with which it was invoked. Rather, a conversational service must use tpreturn(3c) to signify that it has completed its part of the conversation. Similarly, even though a program communicating with a conversational service can issue tpdiscon(), the preferred way is to let the service tear down the connection in tpreturn(3c); doing so ensures correct results.

tpdiscon() causes the connection to be torn down immediately (that is, abortive rather than orderly). Any data that has not yet reached its destination may be lost. tpdiscon() can be issued even when the program on the other end of the connection is participating in the caller's transaction. In this case, the transaction must be aborted. Also, the caller does not need to have control of the connection when tpdiscon() is called.

RETURN VALUES

tpdiscon() function returns -1 on error and sets tperrno to indicate the error condition.

ERRORS

Under the following conditions, tpdiscon() fails and sets tperrno to:

[TPEBADDESC]
cd is invalid or is the descriptor with which a conversational service was invoked.
[TPETIME]
A timeout occurred. The descriptor is no longer valid.
[TPEPROTO]
tpdiscon() was called in an improper context.
[TPESYSTEM]
A System/T error has occurred. The exact nature of the error is written to a log file. The descriptor is no longer valid.
[TPEOS]
An operating system error has occurred. The descriptor is no longer valid.

SEE ALSO

tpabort(3c),
tpcommit(3c),
tpconnect(3c),
tprecv(3c),
tpreturn(3c),
tpsend(3c)