Michael Bauroth ha scritto:
Thank you for the quick response. The problem (or the question) is the same: how can I request, which state is currently active: connected or disconnected? And how can I disconnect the connector (instead of each session separately)?Regards Michael Steve Ulrich (proemion) schrieb:Michael Bauroth wrote:is there a special reason, why the NioSocketConnector hasn't the same methods like the acceptors (bind, unbind, isBound vs. connect, disconnect, isConnected)? Would be fine if somebody could bring some more light into this :)Hi! I think that's because the Acceptor listens to at a specific port and istherfore bound to this port. Just because an acceptor is bound, that doesn't mean that there are any connections. There's even the possibility that the Acceptor is unbound but there are still connections to clients, because the "real" communication is handled over different ports. A connector connectsitself to a server, so there are just 2 posibilites: it is connected to somewhere, or it isn't. hth Steve
SocketConnector connector = new SocketConnector(...
...
ConnectFuture connectFuture = connector.connect(...);
connectFuture.join();
IoSession ioSession = connectFuture.getSession();
...
if(ioSession.isConnected()) {
.....
}
...
ioSession.close();
