Afficher un message
Vieux 27/02/2008, 00h10   #20
coal@mailvault.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Java Serializing in C/C++?

On Feb 26, 3:02pm, James Kanze <james.ka...@gmail.com> wrote:
> On Feb 26, 9:30 pm, c...@mailvault.com wrote:
>
> > On Feb 25, 2:27 pm, k-e-n <copy2...@gmail.com> wrote:

>
> [...]
>
> > > Obviously another thing you can add is the total message
> > > length, again at a fixed location near the beginning of the
> > > message.

> > Do you always use total message lengths? I'm of the opinion
> > that if communication is happening behind a single firewall,
> > the total message lengths can be omitted. That assumes an
> > organization can trust it's employees. For the most part I
> > think that is a safe assumption, but there are some
> > exceptions.

>
> Interestingly, the major use of total message lengths I've seen
> is between processes communicating over a pipe. It's mainly an
> optimization measure, but it can make a significant difference,
> and it can make the code easier to write as well.


I'm not sure why you describe it as an "optimization measure."
It seems to me that not calculating/sending/receiving a total msg
length is simpler if the context permits. What I got out of the
thread on clc++m about denial of service and serialization is that
using a total msg length is important from a security perspective.

>
> > > Create for your self a MessageHeader class and think about
> > > useful things it can contain: Message-Type, Type-Revision,
> > > Element-Count, Byte-Count, ...

> > Why send the Element-Count? It seems redundant given the
> > Message-Type and version number.

>
> It depends. Suppose the Message-Type contains a variable length
> array.
>


You know from the msgid and version number that the message has one
high-level element - a variable length array. And the length of the
array is prepended to the array data as part of the payload. I guess
there is header-like info embedded in the payload the way I think
about it. It could be made part of a header but I'm don't think
there
is anything to be gained from that. If some messages don't have
variable
length data there is a little bit of unnecessary overhead in having a
element count.

Brian Wood
  Réponse avec citation
 
Page generated in 0,05490 seconds with 9 queries