I'm trying to write the simpliest client in RPC with this code:
#include <stdio.h>
#include <stdlib.h>
#include <rpc/rpc.h>
int main(int argc, char *argv[]){
int stat;
char out;
char in='f';
if(stat=callrpc(argv[1],0x20000001, 1, 1, (xdrproc_t)xdr_void, &in, (xdrproc_t)xdr_char, &out)!=0){
clnt_perrno(stat);
exit(1);
}
exit(0);
}
It compiles, but when I try to run it, it gives me a "RPC: Can't encode arguments"
EDIT: Actually the server do not recieve any argument neither it send back anything, that's why I put a xdr_void
added &in
and &out
to avoid segmentation fault error.