最近在学习tuxedo,想在以前用MFC写的系统中运用tuxedo,虽然tuxedo一般用在linux系统中,但其实在开发使用tuxedo中间件的三层架构应用系统中,表示层也经常采用windows风格的程序,由于tuxedo的跨平台特性,便可以把后台应用逻辑运行在unix平台下。
于是在oracle官网上下载了tuxedo12110_64_win_2k8_x86_VS2010.exe,这个是windows上最新的版本,安装好后,便开始使用里面的那个simpapp的例子测试下是否可以使用。
例子中客户端源程序如下:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#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);
}
/* 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]);
/* 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