Hi Harold,

On 4/11/07, Harold Combs <[EMAIL PROTECTED]> wrote:
I've struggled for the past week on how to phrase this question, but here
goes:

I'd like to use MINA to replace an implementation of a proprietary binary
protocol that has both synchronous and asynchronous components.  That is,
part of the communications are regular call/response paradigm, but some are
asynchronous observer-pattern messages.  For the former, the app is acting
like a client, for the latter, the app is acting like a server.  The best
comparison I can think of is SNMP, as it has both regular synchronous ops
(GET, GETNEXT, etc.) and SNMP traps.

In regular Java blocking I/O, we handled this with reader/writer thread pair
attached to a queue.  Items to be sent would be posted the the queue, and
items received were posted to the receive queue.  Simple enough.

So far, for a prototype, I implemented the synchronous parts using an
IOConnector, and that works well enough, but it won't work for the
asynchronous case.  I'm assuming I can implement an IOAcceptor for the
asynchronous case, but how does that handle when I just need to open a
session, send some traffic and receive a response on that same session?

Typically, this app runs both sync and async traffic over the same port, and
I don't think I can have both an IOAcceptor and IOConnector bound to the
same port, correct?

Who makes a connection attempt?  If you always make a connection,
IoConnector is the choice.  If any peer can make a connection, then it
will be somewhat complex.

Assuming that you always make a connection, any incoming message such
as event notification can be handled in IoHandler.messageReceived().
It's too trivial to explain more in detail.  Any incoming data is
notified via messageReceived().  Am I missing something?

HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to