[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Packeting (was: Re: Channel sessions)

From: olafBuddenhagen
Subject: Packeting (was: Re: Channel sessions)
Date: Mon, 3 Sep 2007 02:47:10 +0200
User-agent: Mutt/1.5.16 (2007-06-11)


On Fri, Aug 24, 2007 at 02:14:38PM +0200, Carl Fredrik Hammar wrote:
> <olafBuddenhagen@gmx.net> writes:
> > On Wed, Aug 22, 2007 at 05:23:45PM +0200, Carl Fredrik Hammar wrote:

> >> But one might be able to use generic junctions if one layers a
> >> channel that makes sure all reads and writes are in whole packets.
> >
> > Well, can this really be handled by layering? And is there any
> > advantage in doing so? My impression is that packaging should be an
> > inherent property of all channel interfaces. But then, I haven't
> > thought through the details...
> Packets only causes problems in junctions that splits a stream, where
> one have to make sure that packets aren't split up and sent to
> different recipients.  Assuming that the junction splits a stream
> based on requests, e.g. this read here, next read there.  This could
> be handled by layering a `packeter' above the junction, which makes
> sure that reads and writes are in whole packets.  When read, such a
> channel completes any incomplete packets by reading more from the
> junction than requested, keeping the extra data in a buffer, until the
> nest read on this channel.  It also makes sure no other channel can
> read the junction until it has the complete packet.  When written, it
> only writes any complete packets to the junction, keeping the
> incomplete one in a buffer.

That doesn't make much sense when implementing a channel-based TCP/IP
stack for example (which is supposed to be one of the main uses for
channels): Pretty much every single layer has to explicitely do
something with the packets. An external packeter won't help here. The
packeting must be explicitely expressed in the interface between layers.

Also, I don't even think this works for junctions in the generic case.
It would be possible for streams where the packeting can be recreated,
i.e. when using fixed sized packets (PCM audio, disk blocks etc.), or
serialized formats where the packeting follows from the data (XML etc.).
For network packets, this wouldn't work however -- once the stream
passes through a layer not aware of it, the packeting would be lost

> But layering only makes sense over a generic junction and the only
> real advantage would be avoiding writing specialized junctions, in
> favor of writing special packters.
> At this point I'm fairly certain we want specialized junctions and
> packeting would be handled by them.  So I think we can leave it at
> that.

OK :-) Hope you don't mind that I brought it up again nevertheless... I
guess it should clear some issues up.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]