有关tuxedo客户端的程序问题
#include<stdio.h>#include"atmi.h"#include"fml.h"/*myfuncmustbedefinedasbelow,otherdef...
#include <stdio.h>
#include "atmi.h"
#include "fml.h"
/*myfunc must be defined as below,other define is error*/
void _TMDLLENTRY myfunc(char *buffer,long len,long flag)
{
long len2;
char buftype[20],subtype[20];
if ((len2=tptypes(buffer,buftype,subtype))<0)
{
printf("invalid buffer receive;\n");
}
else if(!strcmp(buftype,"STRING"))
{
printf("unsolicited message from server\n:%s\n",buffer);
}
else if(!strcmp(buftype,"FML"))
{
printf("unsolicited message from server:\n");
Fprint(buffer);
}
else
printf("cannot print out buffer\n");
}
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
TPEVCTL evctl;
int sub_serv=0;
if(argc != 2) {
(void) fprintf(stderr, "Usage: simpcl money\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]);
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);
}
if(tpsetunsol(myfunc)== TPUNSOLERR)
{
printf("tpsetunsol() failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
//sub_serv=tpsubscribe(eventexpr,filter,(TPEVCTL *)NULL,TPSIGRSTRT);
evctl.flags = TPEVSERVICE;
strcpy(evctl.name1,"CLIENT");
sub_serv=tpsubscribe("BANK_TLR_WITHDRAWAL",NULL,(TPEVCTL *)NULL,TPSIGRSTRT);
if (sub_serv==-1L)
{
printf("tpsubscribe() failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm () ;
exit(1);
}
else
printf("tpsubscribe(BANK_TLR_WITHDRAWAL) success\n");
(void) strcpy(sendbuf, argv[1]);
ret = tpcall("WITHDRAWAL", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
(void) fprintf(stderr, "tpcall(WITHDRAWAL) failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
if (tpunsubscribe(sub_serv,TPSIGRSTRT)==-1)
printf("tpunsubscribe():%s\n",tpstrerror(tperrno));
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
为什么运行之后会出现tpcall(WITCHDRAWAL)failure:TPENOENT-no entry found 的错误
这个问题好像比较难回答,那么请问谁有用tpscrible()和tpunscrible()还有tppost()写的客户端和服务器端例子程序么,或者将simpapp的程序改写,可以编译运行就行。有的话,请发给我。672468756@qq.com如果可用,就给分。 展开
#include "atmi.h"
#include "fml.h"
/*myfunc must be defined as below,other define is error*/
void _TMDLLENTRY myfunc(char *buffer,long len,long flag)
{
long len2;
char buftype[20],subtype[20];
if ((len2=tptypes(buffer,buftype,subtype))<0)
{
printf("invalid buffer receive;\n");
}
else if(!strcmp(buftype,"STRING"))
{
printf("unsolicited message from server\n:%s\n",buffer);
}
else if(!strcmp(buftype,"FML"))
{
printf("unsolicited message from server:\n");
Fprint(buffer);
}
else
printf("cannot print out buffer\n");
}
#if defined(__STDC__) || defined(__cplusplus)
main(int argc, char *argv[])
#else
main(argc, argv)
int argc;
char *argv[];
#endif
{
char *sendbuf, *rcvbuf;
long sendlen, rcvlen;
int ret;
TPEVCTL evctl;
int sub_serv=0;
if(argc != 2) {
(void) fprintf(stderr, "Usage: simpcl money\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]);
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);
}
if(tpsetunsol(myfunc)== TPUNSOLERR)
{
printf("tpsetunsol() failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
//sub_serv=tpsubscribe(eventexpr,filter,(TPEVCTL *)NULL,TPSIGRSTRT);
evctl.flags = TPEVSERVICE;
strcpy(evctl.name1,"CLIENT");
sub_serv=tpsubscribe("BANK_TLR_WITHDRAWAL",NULL,(TPEVCTL *)NULL,TPSIGRSTRT);
if (sub_serv==-1L)
{
printf("tpsubscribe() failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm () ;
exit(1);
}
else
printf("tpsubscribe(BANK_TLR_WITHDRAWAL) success\n");
(void) strcpy(sendbuf, argv[1]);
ret = tpcall("WITHDRAWAL", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
if(ret == -1) {
(void) fprintf(stderr, "tpcall(WITHDRAWAL) failure:%s\n",tpstrerror(tperrno));
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
exit(1);
}
(void) fprintf(stdout, "Returned string is: %s\n", rcvbuf);
if (tpunsubscribe(sub_serv,TPSIGRSTRT)==-1)
printf("tpunsubscribe():%s\n",tpstrerror(tperrno));
/* Free Buffers & Detach from System/T */
tpfree(sendbuf);
tpfree(rcvbuf);
tpterm();
return(0);
}
为什么运行之后会出现tpcall(WITCHDRAWAL)failure:TPENOENT-no entry found 的错误
这个问题好像比较难回答,那么请问谁有用tpscrible()和tpunscrible()还有tppost()写的客户端和服务器端例子程序么,或者将simpapp的程序改写,可以编译运行就行。有的话,请发给我。672468756@qq.com如果可用,就给分。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询