Le 7/18/12 6:22 PM, kenny.xiang a écrit :
I use Mina to develop a system,Recently, I see this error("handler cannot
be set while the service is active") in the log。 I find that it exists in
the AbstractIoService.class I do not know why such reported errors, and
this error will cause any impact?? Look forward to your reply,Thank you.

You have set the handler after having started the service. It can't work.

Set your handler and then bind your service. Here is an example :

        socketAcceptor = new NioSocketAcceptor();

        ((NioSocketAcceptor) socketAcceptor).setReuseAddress(true);

socketAcceptor.setHandler(new EchoProtocolHandler() {
@Override
            public void messageReceived(IoSession session, Object message)
                    throws Exception {
                // Whatever you need to do with your message
            }
        });

SocketAddress address = new InetSocketAddress(7777);

socketAcceptor.bind(address);
        ...


--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to