Hi t.s,
First off, sorry for the late reply. We were busy with some development
talk. :)
This is an interesting problem. In this case, the delimiter should be
dynamic, which means TextLineDecoder should provide an extension point so
you can determine if you encountered the delimiter or not depending on
context.
Actually, we are thinking of providing a better codec framework to deal
with this kind of 'framing' issue, and it should be resolved in MINA 2.
However, I'm afraid you will not get this feature in MINA 1.x.
Meanwhile, you will have to modify the TextLineDecoder by yourself to
accomplish what you need.
HTH,
On Tue, 06 May 2008 16:50:51 +0900, truesaint <[EMAIL PROTECTED]> wrote:
Hello all,
I'm new to Mina, currently in the process of writing a server, according
to a protocol that someone else wrote. The "handshake" sequence goes
like this :
1. client connects.
2. server says "Hi, this is SERVER BLAH BLAH <CR><LF>"
3. server says "Login:" --> note: without <CR><LF>
4. client replies with "username<CR><LF>"
5. server says "Password:" --> note: without <CR><LF>
6. client replies with "password<CR><LF"
7. if ok, server says "Login OK <CR><LF>",
otherwise "Login FAIL <CR><LF>"
8. server sends out multiple lines of data, with <CR><LF> as
end-of-line marker.
I'm currently using the supplied TextLineCodecFactory, overridden using
LineDelimiter.WINDOWS as both the encoder and decoder. The problem is
with item #3 and #5 above, since the protocol expects a line without
<CR><LF>. I have no idea where to start.
Thank you very much in advance,
t.s.
PS: Unfortunately the protocol is "set in stone" so i can't change it.
--
Trustin Lee - Principal Software Engineer, JBoss, Red Hat
--
what we call human nature is actually human habit
--
http://gleamynode.net/