RPC - multithread: Client.c

2008年3月1日 星期六 | 標籤: | |

/*
* usage: client server-host int-num
* send an integer and collect returns
*/

#include
#include
#include "show.h"

main(argc, argv)
int argc;
char *argv[];
{
CLIENT *clnt;
char *server;
int *result;
int data;

if (argc != 3)
{
printf("usage:%s server integer\n", argv[0]);
exit(1);
}

server = argv[1];
data = atoi(argv[2]);

clnt = clnt_create(server, SHOWPROG, SHOWVER, "tcp");
if (clnt == (CLIENT *)NULL)
{
clnt_pcreateerror(server);
exit(1);
}

result = show_1(&data, clnt);

if (result == (int *)NULL)
{
printf("error\n");
clnt_perror(clnt, server);
exit(1);
}

printf("Parm is now %d\n", *result);
exit(0);
}

0 意見:

現在時間

HSI

Google
 
Powered By Blogger