users@grizzly.java.net

ServerSocket -> Grizzly Implementation ?

From: dentz <mauriciovondentz_at_gmail.com>
Date: Fri, 2 Oct 2009 13:08:54 -0700 (PDT)

Hi,

I have a Server implementation like this:

ServerSocket s = new ServerSocket(this.port);
while (true)
{
    logger.info("Waiting....!");
    Socket conexao = s.accept();
    logger.info("Connected!");
    /* do Something...*/
}

I need to know when a new connection have been established.
I tried using a custom Filter but with no success.

Is threre a way to do that with Grizzly (1.9.18a or 2.0.0 M3)?

That's my Grizzly implementation so far:

    //--------------
    TCPSelectorHandler selectorHandler = new TCPSelectorHandler();
    selectorHandler.setPort(PORT);
    selectorHandler.setInet(InetAddress.getByName(HOST));
                
    controller.setSelectorHandler(selectorHandler);
                
    DefaultThreadPool threadPool = new
DefaultThreadPool("ThreadPool",5,10,100,TimeUnit.DAYS);
    controller.setThreadPool(threadPool);
                
    //Protocol Chain
    controller.setProtocolChainInstanceHandler(new
DefaultProtocolChainInstanceHandler(){
        @Override
        public ProtocolChain poll() {
            ProtocolChain protocolChain = protocolChains.poll();
            if (protocolChain == null){
                protocolChain = new DefaultProtocolChain();
                protocolChain.addFilter(myFilter);
            }
                return protocolChain;
        }
    });

    controller.start();
    //--------------


Thanks! []'s

ps. Sorry for my english! :P
                           

-- 
View this message in context: http://www.nabble.com/ServerSocket--%3E-Grizzly-Implementation---tp25721796p25721796.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.