Squee wrote:
Yes, we could I suppose, but it's kinda handy to have only one
connector to manage, especially when we need to shut it down and close
connections, rather than running to every connector to close it down.
Either way works, but it's definitely easier to use a single
connector. That was one thing we liked about moving to MINA from using
Sockets directly and managing that kind of thing ourselves. And of
course all of the other benefits MINA provides :)
There is still something mysterious to me : if you manage more than one
session, then you have more than one DataChannel opened. You will have
to close them anyway, one by one. If you use Connector instead you just
have the same problem, without the burden to use the
SingleSessionIoHandler class.
A Session is associated to a single connection anyway. If you have
sequential sessions (ie, you establish a new one when you're done with
the previous one), you just havs to switch the handler when switching
the session. If you have parallel sessions, then you can use as many
connectors as needed to handle all the sessions, and each session will
have its own handler.
In any case, you just have to call connect(SocketChannel handle,
SocketAddress remoteAddress), which will deal with all the details you
are handling on your side not using a connector atm...
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org