OpenTP1 Version 7 TP1/Client User's Guide TP1/Client/W, TP1/Client/P
(a) TP1/Client/W
#include <dcvxatmi.h>
int tpsend(DCLONG cd, char *data, DCLONG len,
DCLONG flags,
DCLONG *revent)
(b) TP1/Client/P
#include <dcvxatmi.h>
int tpsend(DCLONG cd, char CLTFAR *data, DCLONG len,
DCLONG flags, DCLONG CLTFAR *revent)
(2) Purpose
Sends data to the interactive service.
The system with control of connection can issue the tpsend function.
(3) Arguments set by UAPs
- cd
Specify the connection for sending data. Specify the descriptor indicated by the return value of the tpconnect function.
When an event is set for cd, the tpsend function terminates without sending data, assuming that processing failed.
- data
Specify X_OCTET as the pointer to the typed buffer that contains data to be sent.
Specifying NULL results in error.
Specify the same value that defined in the interactive service.
- len
Specify the length of data to be sent. The maximum length is 500 x 1024 bytes. Specify 0 for the address of the pointer to the buffer for which the length need not be specified. Do not specify 0 for the buffer whose length must be specified.
- flags
Specify any of the following.
- TPRECVONLY
- The issuer of the tpsend function aborts control of connection after sending data. The issuer can no longer issue the tpsend function. When the receiver at the other end of connection receives data sent by the tpsend function, it also receives the event (TPEV_SENDONLY) that indicates control of connection. The data receiver can no longer issue the tprecv function.
- TPNOBLOCK
- When the blocking status occurred (e.g., the internal buffer is filled with messages sent), neither data nor event is sent.
- If the blocking status occurs with TPNOBLOCK not specified, the issuer of the tpsend function remains blocked until the communication is resumed or a transaction or blocking timeout error occurs.
- TPNOTIME
- The issuer of the tpsend function is blocked infinitely. Blocking timeout error will never occur. However, transaction timeout error may occur.
- TPSIGRSTRT
- System call interrupted by a signal during execution is recalled.
- revent
Specify the pointer to the typed buffer that indicates an event.
The following events can be returned by the tpsend function.
- TPEV_DISCONIMM
- The connection is immediately disconnected by the tpdiscon function issued by the initiator. Or, it is disconnected due to a communication error such as failure of the server, machine, or network.
- When the connection is disconnected by the tpdiscon function, TPEV_DISCONIMM is reported to the remote system. When the connection is disconnected due to a communication error, TPEV_DISCONIMM is returned to both the initiator and the remote system.
- TPEV_SVCERR
- The remote system that has no control of connection issued the tpreturn function. TPEV_SVCERR is returned to the initiator.
- TPEV_SVCFAIL
- The remote system that has no control of connection issued the tpreturn function. TPEV_SVCFAIL is returned to the initiator.
- Also, the tpreturn function was called without TPFAIL or data specified. TPFAIL is specified in rval and NULL in data.
- These events indicate that the connection was disconnected immediately, causing all data to be lost. The descriptor used for the connection is invalidated. The transaction that contains the two programs is rolled back.
(4) Return values
If an error occurs, the tpsend function returns -1 and sets one of the following values in tperrno as a return value to report the information about the error.
Return value |
Meaning |
TPEINVAL |
Invalid argument |
TPEBADDESC |
Invalid descriptor is specified in cd. |
TPETIME |
A timeout error occurred.
- For the issuer in the transaction mode:
A transaction timeout error occurred. The transaction is rolled back. In this case, TPETIME is returned to new data transmission or undetermined response until the transaction is rolled back.
- For the issuer in other than the transaction mode:
A blocking timeout error occurred where neither TPNOBLOCK nor TPNOTIME is specified.
In either case, the value specified in *data is not changed. |
TPEEVENT |
An event occurred. The return value is returned to revent. |
TPEBLOCK |
Blocking status occurred when the tprecv function was issued with TPNOBLOCK specified. |
TPGOTSIG |
The signal is received, but TPSIGRSTRT is not specified. |
TPEPROTO |
Inappropriate status for issuing the tpsend function. |
TPESYSTEM |
An error occurred in the communication resource manager. |
TPEOS |
An error occurred in the operating system. |
- TPNOBLOCK is invalid for OpenTP1. TPEBLOCK is not returned. When communication is disabled due to the blocking status under OpenTP1, TPESYSTEM is returned as well as for communication disabled due to shutdown of network.
- TPNOTIME is invalid for OpenTP1.
- TPSIGRSTRT is invalid. Whether or not TPSIGRSTRT is specified does not affect operation. When a signal is received, processing is interrupted and the system call is recalled. TPGOTSIG is not returned.
- If a transaction timeout error occurred under OpenTP1, the process terminates abnormally. TPETIME is returned only for a blocking timeout error.
- Unless otherwise specified for X/Open, the error that needs rollback of the transaction under OpenTP1 is TPESYSTEM. Some transactions may not be rolled back if TPESYSTEM is returned.
- OpenTP1 cannot report an event by tpsend function even if the remote system of the service issued the tpdiscon or tpreturn function, unless the event has been received by the process that calls the tpsend function.
- If a transaction timeout error occurred under TP1/Client, the CUP execution process terminates abnormally and all the connections established before the timeout error are disconnected. TPETIME is returned only for a blocking timeout error.
- When TPESYSTEM is returned for an error in TP1/Client, error information is output to the error log.
- When TPEOS is returned, insufficient memory is suspected to be the cause. Error information is output to the error log when the error occurred in TP1/Client.
All Rights Reserved. Copyright (C) 2006, 2009, Hitachi, Ltd.