BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Programming   |   Topic List   |   Previous   |   Next   |   Contents

   Programming a BEA Tuxedo Application Using C

Establishing a Connection

The tpconnect(3c) function sets up a conversation.

Use the following signature to call the tpconnect() function.

int
tpconnect(char *name, char *data, long len, long flags)

The following table describes the arguments to the tpconnect() function.

tpconnect( ) Function Arguments

Argument

Description

name

Character pointer to a conversational service name. If you do not specify name as a pointer to a conversational service, the call fails with a value of -1 and tperrno is set to the error code TPENOENT.

data

Pointer to a data buffer. When establishing the connection, you can send data simultaneously by setting the data argument to point to a buffer previously allocated by tpalloc(). The type and subtype of the buffer must be types recognized by the service being called. You can set the value of data to NULL to specify that no data is to be sent.

The conversational service being called receives the data and len pointers via the TPSVCINFO data structure passed to it by main() when the service is invoked. (A request/response service receives the data and len pointers in the same way.) For more information on the TPSVCINFO data structure, refer to Defining a Service.

len

Length of the data buffer. If the buffer is self-defining (for example, an FML buffer), you can set len to 0.

flag

Specifies the flag settings. For a complete list of valid flag settings, refer to tpconnect(3c) in the BEA Tuxedo C Function Reference.

The system notifies the called service through the flag members of the TPSVCINFO structure.

The BEA Tuxedo system returns a connection descriptor (cd) when a connection is established with tpconnect(). The cd is used to identify subsequent message transmissions with a particular conversation. A client or conversational service can participate in more than one conversation simultaneously. The maximum number of simultaneous conversations is 64.

In the event of a failure, the tpconnect() function returns a value of -1 and sets tperrno to the appropriate error condition. For a list of possible error codes, refer to tpconnect(3c) in the BEA Tuxedo C Function Reference.

The following example shows how to use the tpconnect() function.

Establishing a Conversational Connection


#include atmi.h
#define FAIL -1
int cd1; /* Connection Descriptor */
main()
{
if ((cd = tpconnect("AUDITC",NULL,0,TPSENDONLY)) == -1) {
error routine
}
}