On Tue, Jun 10, 2008 at 10:59 PM, Jeremy Fox <[EMAIL PROTECTED]> wrote:
> Hello Alex, > > Thanks for the fast reply! > NP. Thanks for using MINA. > > To explain it better - I have an acceptor that is listening for UDP packets > from many different sources, but I also need to be able to send packets back > out to some of the sources that originate from the same port that they are > sending packets to. The code to trigger a packet to be sent (as well as the > IP to send it to) will be coming from a JMS message or webservice. > 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
