RPC Programming in Linux
Hello
I am trying to learn RPC programming in Linux. I wrote the following .x file struct Params { float a; float b; float c; }; struct Result { float x1; float x2; }; program QUADRATIC_PROGRAM { version QUADRATIC_VERSION { Result QUADRATIC_PROCEDURE(Params) = 1; } = 1; } = 0x33000000; and the following client program #include <rpc/rpc.h> #include <stdio.h> #include <stdlib.h> #include "quad.h" int main(int argc,char** argv) { CLIENT* ClientHandle; Result* OneResult; Params OneEquation; if (argc != 6) puts("USAGE: client <server_host> <a> <b> <c> <protocol>"); else { OneEquation.a = atof(argv[2]); OneEquation.b = atof(argv[3]); OneEquation.c = atof(argv[4]); printf("Processing for parameters %f:%f:%f\n", OneEquation.a,OneEquation.b,OneEquation.c); ClientHandle = clnt_create(argv[1],QUADRATIC_PROGRAM, QUADRATIC_VERSION,argv[5]); if (ClientHandle == NULL) { printf("Error acquiring client handle\n"); exit (0); } printf("Client Handle acquired for %s over %s\n",argv[1], argv[5]); if ((OneResult = quadratic_procedure_1(&OneEquation,ClientHandle)) != NULL) { printf("Roots are %f : %f\n",OneResult.x1,OeResult.x2); } else printf("Error: %s\n",clnt_sperror(ClientHandle,argv[1])); } return(0); } I compiled the program using the following commands g++ -c client.c g++ -c quad_clnt.c g++ -c quad_xdr.c g++ client.o quad_clnt.o quad_xdr.o -o client -lnsl NOW when I execute the program using the following command, ./client 127.0.0.1 1 0 -4 tcp I cannot get a handle to the client Can some one help Thank you OMAR. |
Where is the server?
|
Thanks Malicious
I works with the server up and running Best Wishes & Regards OMAR. |
All times are GMT -5. The time now is 12:32 PM. |