/*
* Bind the TCP port
*/
m_tcpAcceptor = new NioSocketAcceptor();
m_tcpAcceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new PokenetCodecFactory()));
m_tcpAcceptor.setHandler(m_tcpProtocolHandler);
try {
m_tcpAcceptor.bind(new InetSocketAddress(7002));
System.out.println("INFO: TCP acceptor started.");
} catch (Exception e) {
e.printStackTrace();
return;
}
/*
* Bind the UDP port
*/
m_udpAcceptor = new NioDatagramAcceptor();
m_udpAcceptor.setHandler(m_udpProtocolHandler);
DefaultIoFilterChainBuilder chain = m_udpAcceptor.getFilterChain();
chain.addLast("codec", new ProtocolCodecFilter(new PokenetCodecFactory()));
DatagramSessionConfig dcfg = m_udpAcceptor.getSessionConfig();
dcfg.setReuseAddress(true);
try {
m_udpAcceptor.bind(new InetSocketAddress(7005));
System.out.println("INFO: UDP acceptor started.");