I have written a simple RPC program for a simple increment operation on an integer using RPCGEN.
Code is getting compiled fine without any errors, when i call the client after starting the server, the method which i wrote for server is not getting called even after writing a small print statement to check whether the remote method is being called or not, i have no idea where i am going wrong
Here are the codes which i wrote
incapp_clnt.c
Code:
int main(int argc,char* argv[])
{
CLIENT *cl;
int a= 9;
int *num,*res;
num = &a;
if (argc != 2) {
printf("Usage: firstmain hostname\n");
exit(1);
}
cl = clnt_create(argv[1], ADDAPP, ADDAPP_V1,"tcp");
if (cl == NULL)
{
printf("error: could not connect to server.\n");
return 1;
}
printf("The value of num is:%d\n",*num);
res = add_1(num,cl);
printf("Back from firsttry\n");
if (res == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("After addition=%d\n",*res);
return 0;
}
incapp_svr.c
Code:
int* add_1_svc(int* num, struct svc_req* cli)
{
printf("The server is getting called"); //For checking whether server is being called or not
int b;
int *res;
b = *num++;
res = &b;
return res;
}
Please tell me where i am going wrong
Thanks a lot in advance
Siddarth777