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

BEA Tuxedo Clients

A BEA Tuxedo client is a software module that collects a user request and forwards it to a server that offers the requested service. Almost any software module can become a BEA Tuxedo client by calling the ATMI client initialization routine and "joining" the BEA Tuxedo application. The client can then allocate message buffers and exchange information with the server.

The client calls the ATMI termination routine to "leave" the application and notify the BEA Tuxedo system that it (the client) no longer needs to be tracked. Consequently, BEA Tuxedo application resources are made available for other operations.

The operation of a basic client process can be summarized by the pseudo-code shown in the following listing.

Pseudo-code for a Request/Response Client


main()
{
allocate a TPINIT buffer
place initial client identification in buffer
enroll as a client of the BEA Tuxedo application
allocate buffer
do while true {
place user input in buffer
send service request
receive reply
pass reply to the user }
leave application
}


Most of the actions described in the above listing are implemented with ATMI functions. Others-placing the user input in a buffer and passing the reply to the user-are implemented with C language functions.

During the "allocate buffer" phase, the client program allocates a memory area, called a typed buffer, from the BEA Tuxedo run-time system. A typed buffer is simply a memory buffer with an associated format, for example, a C structure.

A client may send and receive any number of service requests before leaving the application. The client may send these requests as a series of request/response calls or, if it is important to carry state information from one call to the next, by establishing a connection to a conversational server. In both cases, the logic in the client program is similar, but different ATMI functions are required for these two approaches.

Before you can execute a client, you must run the buildclient command to compile it and link it with the BEA Tuxedo ATMI and required libraries. Refer to Writing Clients for information on the buildclient command.