Re: Help Needed for Marshalling Message
From: Nils Petter Vaskinn (no_at_spam.for.me.invalid)
Date: 11/11/03
- Next message: Alan Connor: "Re: Newbie C programming question - "Press any key to continue""
- Previous message: goose: "Re: How to avoid the error "Arg list too long" on IBM ?"
- In reply to: Terence: "Help Needed for Marshalling Message"
- Next in thread: Keith Thompson: "Re: Help Needed for Marshalling Message"
- Reply: Keith Thompson: "Re: Help Needed for Marshalling Message"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 11 Nov 2003 08:31:02 GMT
On Tue, 11 Nov 2003 03:06:51 +0000, Terence wrote:
> Help Need!!!
> I am writing a program for a distributed system course. I need to
> marshall all the messages in order to send them thru a socket. The first
> 8 bytes of the message are used to store the length of the message, and
> then the rest are the actual content of the message. So I have a big
> char array, what is the easiest way to store an 8-byte integer across
> the first 8 characters in the array?
That's mighty big. Will there ever be messages lager than 2^32 ? If yes it
sound's like you're doing some really heavy duty data shuffling.
This is based on the assumption that you have the same integer
representation on both ends of the wire:
/* untested and never compiled */
#include <stdint.h>
/* copy the bits of value into an array */ foo(char *array, uint64_t
value) {
memcpy(array,&value,sizeof value);
}
--
NPV
"the large print giveth, and the small print taketh away"
Tom Waits - Step right up
- Next message: Alan Connor: "Re: Newbie C programming question - "Press any key to continue""
- Previous message: goose: "Re: How to avoid the error "Arg list too long" on IBM ?"
- In reply to: Terence: "Help Needed for Marshalling Message"
- Next in thread: Keith Thompson: "Re: Help Needed for Marshalling Message"
- Reply: Keith Thompson: "Re: Help Needed for Marshalling Message"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|