OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

tpdiscon - Terminate a conversational service connection abortively

Format

ANSI C, C++

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

K&R C

#include <xatmi.h>
int tpdiscon (cd)
int    cd;

Description

The function tpdiscon() immediately terminates the connection specified by cd and generates a TPEV_DISCONIMM event on the other end of the connection.

The function tpdiscon() can be called only by the originator 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() 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 terminate the connection in tpreturn(); doing so ensures correct results.

The function tpdiscon() causes the connection to be terminated immediately (that is, abortively 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 rolled back. Also, the caller does not need to have control of the connection when tpdiscon() is called.

<<Argument>>

<<cd

Specify a descriptor.>>

Return value

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

Errors

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

Return value Return value (numeric) Explanation
TPEBADDESC 2 The argument cd is invalid, or is the descriptor with which a conversational service was invoked.
TPETIME 13 A timeout occurred. The descriptor is no longer valid.
TPEPROTO 9 The function tpdiscon() was called in an improper context.
TPESYSTEM 12 A communication resource manager system error has occurred. The exact nature of the error is determined in a product-specific manner.
TPEOS 7 An operating system error has occurred. The exact nature of the error is determined in a product-specific manner.

See also

tpconnect(), tprecv(), tpreturn(), tpsend().

<<Notes on use with OpenTP1>>

  1. <<The error code TPETIME will not be returned to tperrno under the relevant version of the OpenTP1.>>
  2. <<For OSI TP communication using TP1/NET/OSI-TP-Extended, conversational service communication cannot be held. If this is done, the system operation is undefined.>>