mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorenz Breu <...@hot-shot.com>
Subject UDP request/response, second attempt
Date Thu, 06 Nov 2008 13:57:54 GMT
Hi again

OK, these questions may seem dumb to you, so sorry for the inconvenience.
Anyway, has anybody ever implemented a request/response mechanism using
the Datagram classes in MINA (e.g. NIODatagramConnector)? My question is
if it was intended to be used in this way, i.e. if is possible for an
Acceptor's handler to do a session.write(reply) after receiving a
request and a Connector's handler to do a session.read(reply) after
sending the request. In java.io a socket can be read from after a send
event, but what I have to do now is prepare a connector (i.e. find a
free port), then start an acceptor on that port. When that is ready I
can send the request. The acceptor on the other side receives the
message and sends the reply back out through it's own connector to the
port the request came from. The original sender then receives the reply
on it's acceptor and disposes the acceptor once the message is received.
So for each request/reply the requester has to set up and dispose a new
acceptor, which may lead to unnecessary overhead(??). I was considering
adding a java.io "reply socket" to my AprDatagramSession, but that would
be a hack and wouldn't quite fit in with the rest of the framework.

So, to summarize, should it be possible to reply to a request within a
DatagramSession? Has it been done with the NIO stuff? If so, I would
continue looking for a solution in the APR transport classes.

Regards,
Lorenz

Mime
View raw message