* xdr functions cause segmentation fault
@ 2002-06-07 5:59 Alina Valea
0 siblings, 0 replies; only message in thread
From: Alina Valea @ 2002-06-07 5:59 UTC (permalink / raw)
To: linux-c-programming
Hello everybody,
I have one client program that sends a message string to a
server program, which echoes it back to the client.
The server side: ... char * print_message(char *message) {
printf("Arg: %s\n",message); return message; }
void main() {
... if(registerrpc (PRINTPROG,PRINTVERS,PRINTPROC_NUM,
print_message,xdr_message,xdr_message, "visible")==-1) { ...}
svc_run(); }
The client side: ... char
*tokens[]={"message1","message2","message3","message4"}; char
result[20];
while(1) { i=counter++ % 4; if( (error_code=callrpc(
"localhost", PRINTPROG, PRINTVERS, PRINTPROC_NUM, xdr_message,
tokens[i], xdr_message, result))!=RPC_SUCCESS) {...}
printf("client: %s\n",result); }
where bool_t xdr_message(XDR *xdrs, char *message) { return
(xdr_string(xdrs,&message,20)); }
The problem is I always get a segmentation fault on the
server side (using any of the xdr_message(),
xdr_wrapstring(),xdr_string()) after the receipt and printing
of the first string. The only time the server doesn't crash is
when using xdr_message() on the client side, and
xdr_wrapstring() on the server side. Except that the server
won't print the right string, but 'I', over and over.
Even more, I get a gcc warning on compiling the client: args
5,7 of callrpc of incompatible pointer type.
Thanks for your help, Alina
----
Home, no matter how far...
http://www.home.ro
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-06-07 5:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-07 5:59 xdr functions cause segmentation fault Alina Valea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).