![]() |
![]() |
|
|
tpsend(3c)
Name
tpsend()—Routine for sending a message in a conversational connection.
Synopsis
#include <atmi.h>
int tpsend(int cd, char *data, long len, long flags, long *revent)
Description
tpsend() is used to send data across an open connection to another program. The caller must have control of the connection. tpsend()'s first argument, cd, specifies the open connection over which data is sent. cd is a descriptor returned from either tpconnect() or the TPSVCINFO parameter passed to a conversational service.
The second argument, data, must point to a buffer previously allocated by tpalloc(). len specifies how much of the buffer to send. Note that if data points to a buffer of a type that does not require a length to be specified (for example, an FML fielded buffer), then len is ignored (and may be 0). Also, data can be NULL in which case len is ignored (no application data is sent—this might be done, for instance, to grant control of the connection without transmitting any data). The type and subtype of data must match one of the types and subtypes recognized by the other end of the connection.
The following is a list of valid flags:
If an event exists for the descriptor, cd, then tpsend() will fail without sending the caller's data. The event type is returned in revent. Valid events for tpsend() are as follows:
Because each of these events indicates an immediate disconnection notification (that is, abortive rather than orderly), data in transit may be lost. The descriptor used for the connection is no longer valid. If the two programs were participating in the same transaction, then the transaction has been marked abort-only.
If the value of either SVCTIMEOUT in the UBBCONFIG file or TA_SVCTIMEOUT in the TM_MIB is non-zero, TPESVCERR is returned when a service timeout occurs.
In a multithreaded application, a thread in the TPINVALIDCONTEXT state is not allowed to issue a call to tpsend().
Return Values
Upon return from tpsend() where revent is set to either TPEV_SVCSUCC or TPEV_SVCFAIL, the tpurcode() global contains an application-defined value that was sent as part of tpreturn(). The function tpsend() returns -1 on error and sets tperrno() to indicate the error condition. Also, if an event exists and no errors were encountered, tpsend() returns -1 and tperrno() is set to [TPEEVENT].
Errors
Upon failure, tpsend() sets tperrno() to one of the following values:
See Also
tpalloc(3c), tpconnect(3c), tpdiscon(3c), tprecv(3c), tpservice(3c)
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|