From doug@seismo.berkeley.edu Fri Oct 24 10:33:02 1997
Date: Fri, 24 Oct 1997 10:33:02 -0700
From: Doug Neuhauser <doug@seismo.berkeley.edu> Fri 24 Oct 10:33
To: alex@andreas.wr.usgs.gov
Subject: import/export packaging protocol
Cc: doug@seismo.berkeley.edu


Alex,

I have some comments on the message encapulation scheme that you use
for binary import/export.

As I understand, you use a single character start_of_message <stx>, a
single character end of message <etx>, and an <esc> character to quote
<stx>, <etx>, and <esc>.

In import_generic, on startup of MessageReceiver() you look for the
beginning of the first message by scanning for a <stx> that is not
preceed by an <esc>.  If you frame on just the initial <stx> character,
you risk starting in the middle of a message.  However, even if you
start at the beginning of a packet, you are quaranteed to discard the
first packet because you do not look for the start_of_message <stx>
until the second character.

This means that it can provide a reliable transport stream one
the socket is opened and framing has ocurred, but it is guaranteed to
lose at least one message at the start of each connection, and over
each close/reopen of the socket.

If you had used a multi-character start_of_message, such as <soh><stx>,
and <soh> was added to the list of quoted characters, this would make
the start of a message unambiguous even on startup.

- Doug N
