Hello Alex,
Thanks for the fast reply!
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.
I had initially just written a socket monitor that captured packets, which
was pretty straightforward. I just need a way to send packets to some
addresses (triggered by a JMS message) over the same port that I am
listening from.
Thanks again,
Jeremy
----- Original Message -----
From: "Alex Karasulu" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 10, 2008 9:49 PM
Subject: Re: Datagram server implementation question
Hi Jeremy,
On Tue, Jun 10, 2008 at 9:25 PM, Jeremy Fox <[EMAIL PROTECTED]> wrote:
Hello all,
I am still new to using MINA - I read the tutorials, javadoc, and I've
combed the mailing list archives, but I did see anything that addresses
one
of my needs on a project.
I need to do alot of asynchronous UDP communications - generally that is
easy enough, but I not sure how to accomplish what I need to be able to
do
with my IoHandler implementation. I can create an implementation that can
receive packets from a port, or send a packet back to a sender, and they
all
work great. What I need to be able to do, is to receive any packets that
come to that port, as well as send a packet to whatever IP is provided
when
a separate thread (JMS consumer or webservice, etc) calls for it.
Can you explain this a bit more? Sounds like you need to communicate with
another UDP server specified by an IP you get from a JMS or webservice
message.
I had initially thought that I could create new sessions to send a new
packet using my acceptor by calling acceptor.newSession(), but I get an
error: java.lang.IllegalArgumentException: Unknown local address:
localhost:1721. I seem to be getting that error no matter how I specify
my
local address. Does anyone have any ideas, or does anyone know of a
another
(preferably better) way to do this?
If the UDP endpoint you need to communicate with is an established client
to
your UDP server, you may just need to track your sessions and look up the
one to send an unsolicited PDU to. If that's not the case, and you need
to
talk to a UDP service at that IP which you extract from your JMS/web
service
message, then you need to use a Connector rather than an Acceptor to
access
that service as a client.
HTH,
Alex