Le 30/05/2014 13:59, Skywalker a écrit :
> Hi all,
>
> I need help to understanding how Apache Mina 2 maps responses to requests.
> It appears it matches responses to their respective requests by assuming the
> responses will come back on the same socket.
right.
>
> e.g.
> If requests to server leaves on lets say Local Address: /192.168.0.10:53217
> i.e. ProtocolEncoder's session.getLocalAddress(), Apache mina expects
> response on the Local Address: /192.168.0.10:53217 i.e. ProtocolDecoder's
> session.getLocalAddress()
>
> However, I have a situation where the service responds to any available
> socket, e.g. the response could be on Local Address: /192.168.0.10:53282.
No. Never.
>
> I realize Mina is unable to map this response, and I am unable to get this
> response. How do I use something else to map request and response other than
> socket id.

MINA use the concept of Session. A Session is created everytime a remote
host connects to a server. The session is associated to the socket.
Whenever a message arrives on a socket, MINA selects the session
associated to this socket, then propagate the message to the handler,
which can/may send back a response, which is again associated to the
session, thus to the socket. There is no way a session can send a
message tp another socket than the one the session is associated to.

Check that the response is not sent to another session than teh one
whoch receivedthe message.

Reply via email to