[gameprogrammer] Re: Marshalling of data in RPC

How are you doing this?

This is only garanteed to work between the same
arquitechture and with server/client compiled
with the same compiler options.

Cheers,
Paulo

Gautam Narain wrote:
Hi,

I know this is not really related to gamedev but as many people here have worked on RPC I thought I might ask here.

I am trying to do my own marshalling and sending information using rpc function - I am trying to use memcpy - on just the client side this seems to work fine

I do
char *msg = malloc(sizeof(int));
int value = 3;
memcpy(msg, &value, sizeof(int));

On the server side to unmarshal this data I do this(the function has a char **msg as a parameter)

memcpy(&value, *msg, sizeof(int));

But however on the server side I get a junk value. So I am wondering what I am doing wrong. If I use sprintf I do get a proper value but I cannot use sprintf.

Secondly also is there a way to do it using  shift operator(<< and >>) ?

Thanks
Gautam




--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html








---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: