![]() |
![]() |
|
|
Step 3: Examining and Compiling the Server
How to Examine the Server
Review the ATMI server program source code.
$ more simpserv.c
Source Code of simpserv.c
*/
/* #ident "@(#) apps/simpapp/simpserv.c $Revision: 1.1 $" */
1 #include <stdio.h>
2 #include <ctype.h>
3 #include <atmi.h> /* TUXEDO Header File */
4 #include <userlog.h> /* TUXEDO Header File */
5 /* tpsvrinit is executed when a server is booted, before it begins
processing requests. It is not necessary to have this function.
Also available is tpsvrdone (not used in this example), which is
called at server shutdown time.
9 */
10 #if defined(__STDC__) || defined(__cplusplus)
12 tpsvrinit(int argc, char *argv[])
13 #else
14 tpsvrinit(argc, argv)
15 int argc;
16 char **argv;
17 #endif
18 {
19 /* Some compilers warn if argc and argv aren't used.
20 */
21 argc = argc;
22 argv = argv;
23 /* userlog writes to the central TUXEDO message log */
24 userlog("Welcome to the simple server");
25 return(0);
26 }
27 /* This function performs the actual service requested by the client.
Its argument is a structure containing, among other things, a pointer
to the data buffer, and the length of the data buffer.
30 */
31 #ifdef __cplusplus
32 extern "C"
33 #endif
34 void
35 #if defined(__STDC__) || defined(__cplusplus)
36 TOUPPER(TPSVCINFO *rqst)
37 #else
38 TOUPPER(rqst)
39 TPSVCINFO *rqst;
40 #endif
41 {
42 int i;
43
44 for(i = 0; i < rqst->len-1; i++)
45 rqst->data[i] = toupper(rqst->data[i]);
46 /* Return the transformed buffer to the requestor. */
47 tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
48 }
How to Compile the Server
buildserver -o simpserv -f simpserv.c -s TOUPPER
The executable file to be created is named simpserv and simpserv.c is the input source file. The -s TOUPPER option specifies the service to be advertised when the server is booted.
$ ls -l
total 97
-rwxr-x--x 1 usrid grpid 313091 May 28 15:41 simpcl
-rw-r----- 1 usrid grpid 1064 May 28 07:51 simpcl.c
-rwxr-x--x 1 usrid grpid 358369 May 29 09:00 simpserv
-rw-r----- 1 usrid grpid 275 May 28 08:57 simpserv.c
-rw-r----- 1 usrid grpid 392 May 28 07:51 ubbsimple
You now have an executable module called simpserv.
See Also
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|