Hi,
I’m working on RPC in linux , I use Rpcgen to generate the files .
My program is to send an array to a server , the server returns 3 * array…
// .x file const maxnum=50; struct inout_array { int array; }; program MATMULT_PROG { version MATMUL_VER{ inout_array matmul(inout_array)=1; }=1; }=0x23451689; ----------------- //server.c #include "matmul.h" inout_array * matmul_1_svc(inout_array *argp, struct svc_req *rqstp) { static inout_array result; inout_array x; int i; for (i=0;iarray.array_len;i++) result.array.array_val[i]=argp->array.array_val[i]*3; return &result; } -------------------------- //client.c #include "matmul.h" int main (int argc, char *argv[]) { char *host; host = argv[1]; CLIENT *clnt; inout_array *result_1; inout_array matmul_1_arg; int i; int a[maxnum]; //passed array to server int tindex=4; for(i=0;i<argc-2;i++) a[i]=atoi(argv[tindex++]); matmul_1_arg.array.array_val=a; clnt = clnt_create (host, MATMULT_PROG, MATMUL_VER, "tcp"); if (clnt == NULL) { clnt_pcreateerror (host); exit (1); } result_1 = matmul_1(&matmul_1_arg, clnt); if (result_1 == (inout_array * ) NULL) { clnt_perror (clnt, "call failed"); } clnt_destroy (clnt); for(i=0;iarray.array_len;i++) printf("%d\n",result_1->array.array_val[i]); exit (0); } I don't know what goes wrong here! Thanks a lot!