mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yigal Rachman <yi...@uvic.ca>
Subject Re: How to deal with dynamically changing line terminators?
Date Mon, 13 Aug 2007 17:41:18 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, Adam:<br>
<br>
Thank you for pointing me to AsyncWeb - really interesting stuff!&nbsp; I
found ConsumeToCRLFDecoder and ConsumeToCharacterDecoder, but no
ConsumeToDynamicTerminatorDecodingState.&nbsp; Any idea where I might find
this?<br>
<br>
BTW, I have already coded some of my driver using state machines, and
am 100% sold on this way of doing things.&nbsp; It is amazingly efficient
for managing i/o transactions of arbitrary duration because it does not
keep threads waiting.<br>
<br>
- Yigal<br>
<br>
<br>
Adam Fisk wrote:
<blockquote
 cite="midf40963db0708121826u38bf1e32w6f434d8dbd7d981@mail.gmail.com"
 type="cite">
  <pre wrap="">I'd give the state machine in AsyncWeb a look, as well as some of the
helper
classes.  The state machine approach takes awhile to wrap your head around
if you're not used to it, but it works well.  The
"ConsumeToDynamicTerminatorDecodingState" helper class will do exactly what
you want.  You would need to write a fair bit of custom state machine code
for your protocol going this route, but I think it's worth it.

<a class="moz-txt-link-freetext" href="http://docs.safehaus.org/display/ASYNCWEB/Home">http://docs.safehaus.org/display/ASYNCWEB/Home</a>

-Adam


On 8/9/07, Yigal Rachman <a class="moz-txt-link-rfc2396E" href="mailto:yigal@uvic.ca">&lt;yigal@uvic.ca&gt;</a>
wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi, Folks:

I have a MINA client that acts as a driver for a scientific instrument.
The communication is via a serial link using ASCII.  The messages from
the instrument are usually terminated with a line feed, but are
sometimes terminated with a "&gt;" instead (when it is prompting for
commands).

Could you please suggest a design pattern that would do this elegantly
in MINA?  I expect it will use the TextLineCodec and possibly some other
filters, but I am fuzzy on the details.

Best regards,
Yigal Rachman

DMAS Data Acquisition Developer
NEPTUNE Canada
University of Victoria,
Victoria, BC, Canada
<a class="moz-txt-link-abbreviated" href="http://www.neptunecanada.ca">www.neptunecanada.ca</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
<br>
</body>
</html>

Mime
View raw message