tpdiscon - routine for taking down a conversational service connection
#include <atmi.h> int tpdiscon(int cd)
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.
tpdiscon() function returns -1 on error and sets tperrno to indicate the error condition.
Under the following conditions, tpdiscon() fails and sets tperrno to:
tpabort(3c),
tpcommit(3c),
tpconnect(3c),
tprecv(3c),
tpreturn(3c),
tpsend(3c)