You answered that question for me - thank you for that.  I was hoping that
I wouldn't need to deal with the sessions, but it's easy enough to deal
with.  I think what you just basically described is in the chat example
that comes with MINA.

I can add a method to look up the session as described and write the data
to it.  The other question that I have, is where should the method be
called from?  For example, if I have a JMS consumer that consumes a
message with instructions to deliver a packet to a certain IP address,
should that method access the IoHandler through the class that created the
acceptor?  (acceptor.getHandler().insertMySendMethodHere()?)

Thanks again,

Jeremy


> OK I think I see now.  Even though UDP is stateless, MINA still associates
> a
> IoSession with clients.  I think all you need to do is lookup the
> IoSession
> associated with the client that connected to your server.  You could do
> this
> in many ways, but you could probably just use a map with keys derived from
> the IP and port for the client.  So in your handler, you might want to
> track
> the sessions you encounter and manage this map of live sessions using the
> sessionOpened() and sessionClosed() methods of your IoHandler.  Just
> access
> the map to get the client's IoSession when you get the client IP/port info
> from your JMS/Webservice message.  Then send the data back to the client
> by
> writing to it via the IoSession.
>
> Alex
>


Reply via email to