Linux tuxedo entry

Source: Internet
Author: User

After most of the days, I installed tuxedo and wrote the first example. You can use the UI to install it. After installation, I need to configure environment variables, run tux in the tuxedo directory. env configuration, add to/home/Oracle /. bash_profile, Because I installed Oracle and tuxedo as an oracle user.

 

Server code simpserv. C:

# Include <stdio. h>
# Include <ctype. h>
# Include <atmi. h>
# Include <userlog. h>

# If defined (_ stdc _) | defined (_ cplusplus)
Tpsvrinit (INT argc, char * argv [])
# Else
Tpsvrinit (argc, argv)
Int argc;
Char ** argv;
# Endif

{
Argc = argc;
Argv = argv;
Userlog ("welcome to the simple server ");
Return (0 );
}
# Ifdef _ cplusplus
Extern "C"
# Endif

# If defined (_ stdc _) | defined (_ cplusplus)
Void toupper (tpsvcinfo * rqst)
# Else
Void toupper (rqst)
Tpsvcinfo * rqst;
# Endif
{
Int I;
For (I = 0; I <rqst-> len-1; I ++)
Rqst-> data [I] = toupper (rqst-> data [I]);
Tpreturn (tpsuccess, 0, rqst-> data, 0l, 0 );
}

Compilation Method command: buildserver-O simpserv-F simpserv. C-s toupper

 

Client code simpcl. C:

# Include <stdio. h>
# Include <stdlib. h>
# Include <string. h>
# Include "atmi. H"

# If defined (_ stdc _) | defined (_ cplusplus)
Main (INT argc, char * argv [])
# Else
Main (argc, argv)
Int argc;
Char * argv [];
# Endif
{
Char * sendbuf, * rcvbuf, * PTR;
Char * MSG = "tuxedo is powerful .";
Long sendlen, rcvlen;
Int ret;

/* Start connection */
If (tpinit *) null) =-1 ){
(Void) fprintf (stderr, "tpinit failed/N ");
Exit (1 );
}

If (argc! = 2 ){
PTR = MSG;
} Else {
PTR = argv [1];
}
Sendlen = strlen (PTR );

If (sendbuf = (char *) tpalloc ("string", null, sendlen + 1) = NULL ){
(Void) fprintf (stderr, "error allocating send buffer/N ");
Tpterm ();
Exit (1 );
}

If (rcvbuf = (char *) tpalloc ("string", null, sendlen + 1) = NULL ){
(Void) fprintf (stderr, "error allocating Receive Buffer/N ");
Tpterm ();
Exit (1 );
}

(Void) strcpy (sendbuf, PTR );

Ret = tpcall ("toupper", (char *) sendbuf, 0, (char **) & rcvbuf, & rcvlen, (long) 0 );
If (ret =-1 ){
(Void) fprintf (stderr, "can't send request to service toupper/N ");
(Void) fprintf (stderr, "tperrno = % d/N", tperrno );
Tpfree (sendbuf );
Tpfree (rcvbuf );
Tpterm ();
Exit (1 );
}

(Void) fprintf (stdout, "original string is: % s/n", PTR );
(Void) fprintf (stdout, "returned string is: % s/n", rcvbuf );
Tpfree (sendbuf );
Tpfree (rcvbuf );
Tpterm ();
Return (0 );



}

Compile the client: buildclient-O simpcl-F simpcl. c

The most annoying service configuration file ucf.txt:

* Resources

Ipckey 80952

Domainid simpapp
Master Site1
Maxaccessers 10
Maxservers 5
Maxservices 10
Model SHM
Ldbal n
* Machines
Default:
Appdir = "/home/Oracle/tdemos"
Tuxconfig = "/home/Oracle/tdemos/tuxconfig"
Tuxdir = "/Oracle/tuxedo10gr3"
"Rel5" lmid = Site1
* Groups
Group1 lmid = Site1 kgno = 1 openinfo = none
* Servers
Simpserv srvgrp = group1 srvid = 1
* Services
Toupper

The project directory is/home/Oracle/tdemos. Compile the command:

Tmloadcf-y ucf.txt

Compile ucf.txt to generate the service configuration recognized by tuxedo in binary format. The generated binary configuration file name is tuxconfig = "/home/Oracle/tdemos/tuxconfig"

Start tuxedo to run the Service Program

 

After the above steps are complete, run tmboot-y to start the tuxedo service.

 

 

Simple Task Management

Run tmadmin to enter the announcement version task parser.

> SRS

Print Server process information

> PSC-A 2

Print famous service information

> BBS

Print announcement board statistics

Disable the tuxedo Service

Tmshutdow-y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.