client.c
来自「tuxede下面的编程」· C语言 代码 · 共 76 行
C
76 行
/* Copyright (c) 1998 BEA Systems, Inc. All rights reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF BEA Systems, Inc. The copyright notice above does not evidence any actual or intended publication of such source code.*//* Copyright 1996 BEA Systems, Inc. *//* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF *//* BEA Systems, Inc. *//* The copyright notice above does not evidence any *//* actual or intended publication of such source code. *//* Copyright (c) 1992 USL All rights reserved THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF USL The copyright notice above does not evidence any actual or intended publication of such source code.*//* #ident "@(#) apps/qsample/client.c $Revision: 1.1 $" */#include <stdio.h>#include "Uunix.h"#include "atmi.h"int main(int argc, char **argv){ char *reqstr; /* string to be sent */ long len; /* length of return string */ if(argc != 2) { (void) fprintf(stderr, "Usage: client string\n"); exit(1); } /* join the application */ if (tpinit(NULL) == -1) { printf("tpinit() failuer: %s\n",tpstrerror(tperrno)); exit(1); } /* get request buffer */ if ((reqstr = tpalloc("STRING",NULL,1000))==NULL) { printf("tpalloc() failure: %s",tpstrerror(tperrno)); exit(1); } strcpy(reqstr,argv[1]); if( (tpcall("ENQ", (char *)reqstr, 0, (char **)&reqstr, &len, (long)0))==-1) { printf("tpcall() failure,%s\n",tpstrerror(tperrno)); tpterm(); exit(1); } printf("after tpcall(ENQ): %s\n", reqstr); sleep(5); if( (tpcall("DEQ", (char *)reqstr, 0, (char **)&reqstr, &len, (long)0))==-1) { printf("tpcall(DEQ) failure,%d,%s\n",tperrno,tpstrerror(tperrno)); tpterm(); exit(1); } printf("after tpcall(DEQ): %s\n", reqstr); tpfree(reqstr); tpterm();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?