RPC - multithread: server.c
2008年3月1日 星期六 | 標籤: C++ 程式 Sample Source Code | |/*
* show_sp.c : display integer sent by client
*/
#include
#include "show.h"
int * show_1(data, req)
int *data;
struct svc_req *req;
{
static int result;
FILE *f;
sleep (10); /* test multi requests are served by multi threads */
f = fopen("/dev/console","w");
if (f == (FILE *)NULL)
{
printf("Cannot open console\n");
}
else
{
printf("Received client's data : %d\n", *data);
result = (int)(*data) * 2;
}
return &result;
}