Chinaunix首页 | 论坛 | 博客
  • 博客访问: 223665
  • 博文数量: 28
  • 博客积分: 398
  • 博客等级: 一等列兵
  • 技术积分: 1109
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-07 22:28
文章分类
文章存档

2017年(1)

2014年(3)

2013年(7)

2012年(4)

2011年(13)

分类: LINUX

2012-09-13 15:20:59

操作系统选择:
1、Fedora3 2004年发行的,开始用suse11.3和centos5.4分别安装,但是发现有太多依赖库的版本不对,
只能降低操作系统版本。

安装步骤参考:(有截图,非常详细)
http://jsonchar.blog.163.com/blog/static/17601614120109246491760/


工作目录(测试用工作目录 atmi(c/c++)  corba(corba)  jolt(java) ):
/opt/tuxedo/tuxedo8.1/samples/atmi/simpapp

1、编译服务器端程序和客户端程序
#buildserver -f simpserv.c -o simpserv  -s TOUPPER -vt 
#buildclient -f simpcl.c -o simpcl


1、启动、停止服务
tmboot -y
tmshutdown -y


2、装载实例,并生成配置文件tuxconfig
tmloadcf -y ubbsimple

3、客户端测试
[tuxedo@tux2 simpapp]$ ./simpcl "test tuxedo client"
Returned string is: TEST TUXEDO CLIENT
如果返回 【Tpinit failed】,说明服务没启动。


4、tux.env文件配置
TUXDIR=/opt/tuxedo/tuxedo8.1; export TUXDIR
TUXCONFIG=/opt/tuxedo/tuxedo8.1/samples/atmi/simpapp/tuxconfig;export TUXCONFIG
PATH=$TUXDIR/bin:$PATH; export PATH
COBCPY=:$TUXDIR/cobinclude; export COBCPY
COBOPT="-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C O***T=cbl"; export COBOPT
SHLIB_PATH=$TUXDIR/lib:$SHLIB_PATH; export SHLIB_PATH
LIBPATH=$TUXDIR/lib:$LIBPATH; export LIBPATH
LD_LIBRARY_PATH=$TUXDIR/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
WEBJAVADIR=$TUXDIR/udataobj/webgui/java

5、样例文件配置ubbsimple
IPCKEY          123456

*MACHINES

DEFAULT:
                APPDIR="/opt/tuxedo/tuxedo8.1/samples/atmi/simpapp"
                TUXCONFIG="/opt/tuxedo/tuxedo8.1/samples/atmi/simpapp/tuxconfig"
                TUXDIR="/opt/tuxedo/tuxedo8.1/"
                MAXWSCLIENTS=10
                
# LMID=simple
tux2            LMID=simple

*SERVERS
DEFAULT:

                CLOPT="-A "

simpserv        SRVGRP=GROUP1 SRVID=1

WSL     SRVGRP=GROUP1 SRVID=10
        CLOPT="-A -- -n //192.168.71.237:10000 -M5 -m5"
        
        
        
        
6、服务端代码 simpserv.c
编译:buildserver -f simpserv.c -o simpserv  -s TOUPPER,TINFO -vt
#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
TINFO(TPSVCINFO *rqst)
#else
TINFO(rqst)
TPSVCINFO *rqst;
#endif
{

        int i;

/*
        for(i = 0; i < rqst->len-1; i++)
                rqst->data[i] = toupper(rqst->data[i]);
*/
        memset( rqst->data, 0x00, rqst->len );
        sprintf( rqst->data, "Welcome, you are here!");

        /* Return the transformed buffer to the requestor. */
        tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}

7、客户端代码 tclient.c 
编译: buildclient -f tclient.c -o tclient -v -w

#include
//#include
#include "atmi.h"               /* TUXEDO  Header File */

int main(int argc, char *argv[])
{

        char *sendbuf, *rcvbuf;
        long sendlen, rcvlen;
        int ret;

        if(argc != 2) {
                (void) fprintf(stderr, "Usage: simpcl string\n");
                exit(1);
        }

        tuxputenv("WSNADDR=//192.168.71.237:10000");
        /* Attach to System/T as a Client Process */
        if (tpinit((TPINIT *) NULL) == -1) {
                (void) fprintf(stderr, "Tpinit failed\n");
                exit(1);
        }

        sendlen = strlen(argv[1]);

        /* Allocate STRING buffers for the request and the reply */

        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");
                tpfree(sendbuf);
                tpterm();
                exit(1);
        }

        (void) strcpy(sendbuf, argv[1]);

#if 1
        /* Request the service TOUPPER, waiting for a reply */
        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, "Call TOUPPER, Returned string is: %s\n", rcvbuf);
#endif


        memset( rcvbuf, 0x00, strlen(rcvbuf) );
        ret = tpcall("TINFO", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
        if(ret == -1) {
                (void) fprintf(stderr, "Can't send request to service TINFO\n");
                (void) fprintf(stderr, "Tperrno = %d\n", tperrno);
                tpfree(sendbuf);
                tpfree(rcvbuf);
                tpterm();
                exit(1);
        }
        (void) fprintf(stdout, "Call TINFO, Returned string is: %s\n", rcvbuf);

        /* Free Buffers & Detach from System/T */
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
        return(0);
}

8、服务脚本 /etc/init.d/tuxedod
添加到/etc/rc.local启动即可,例如:service tuxedod start
#!/usr/bin/env bash

TUXEDOR_BIN="/opt/tuxedo/tuxedo8.1/bin/"

case "$1" in
'start')
        su - tuxedo -c "${TUXEDOR_BIN}/tmboot -y"
        touch /var/lock/subsys/tuxstart
        ;;
'stop')
        su - tuxedo -c "${TUXEDOR_BIN}/tmshutdown -y"
        rm -f /var/lock/subsys/tuxstart
        ;;
'status')
        wslid=`pidof WSL`
        if ! [ -z "$wslid" ]
        then
                echo "tuxedo server is start, id " ${wslid}
        else
                echo "tuxedo server is stop"
        fi
        ;;
*)
        echo "Usage: $0 { start | stop }"
        ;;
esac

exit 0

9、License文件名 lic.txt,许可数达到1000000,放到 ${TUXDIR}/udataobj/目录下:

[BEA TUXEDO]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MCwCFHhwldUJRHzdS56JZsa/qRIfym2DAhRtpUV6KFnTDKO1YYpjWX+yF68J2Q==

[LINK ENCRYPTION]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
STRENGTH=56
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MC4CFQCAmHbMkQkhq/FRmrTnP3LZteUzPQIVAKPMljyB5hCJUWeeNAu5QE6QxMmw

[PK ENCRYPTION]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
STRENGTH=56
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MCwCFAnnZZS7AKBmbqGgg2EowAI8t1taAhQA4GJJFS2IpcetyFKLdHvWOlTQWQ==

[PK SIGNATURE]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
STRENGTH=56
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MC0CFB3KkdpWsDQNFPt5v9XvxOqHxiLuAhUAu0npE/WcoKkxk1yu/apuPI5VlWc=

[SNMP]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MC0CFFEGnZqS4JapccQP56gaG/8S5+mRAhUAsh8PJh1ZMS0Ft7PJsF1cxM7Uyv8=

[SSL ENCRYPTION]
DEVELOPERS=1000000
LICENSEE=Customer
SERIAL=454493271161-2671077484631
STRENGTH=56
TYPE=SDK
USERS=1000000
VERSION=8.1
SIGNATURE=MCwCFCi+qmB2Z24bNNJRsS7iagAJ/edhAhQHaPTDOZeXFt2k/AYjm+a5CoQkkg==





阅读(2509) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~