Le 28/09/16 à 15:15, rafrl a écrit :
> Dears,
>
> I have a problem using apache mina UDP server. I receive two connections are
> two sources with different ip but leaving the same port. The mina it is not
> creat a new sessions for each connection and is differentiating sessions and
> mixing the defined attributes. Someone passed a similar problem ?
No. Sessions are created on the fly when we get a new message, based on
the remote address :
private IoSession newSessionWithoutLock(SocketAddress remoteAddress,
SocketAddress localAddress) throws Exception {
DatagramChannel handle = boundHandles.get(localAddress);
if (handle == null) {
throw new IllegalArgumentException("Unknown local address: "
+ localAddress);
}
IoSession session;
synchronized (sessionRecycler) {
session = sessionRecycler.recycle(remoteAddress);
if (session != null) {
return session;
}
// If a new session needs to be created.
NioSession newSession = newSession(this, handle, remoteAddress);
getSessionRecycler().put(newSession);
session = newSession;
}
...
You probably have something wrong in your code, or you are using an
antiquated version of mina.