Code example for ServerSocketChannel

Methods: accept

0
    public void accept(SelectionKey key)
    { 
        try 
        { 
            ServerSocketChannel serverChannel = (ServerSocketChannel)key.channel();
            SocketChannel client = serverChannel.accept();
            if ( client != null )
            { 
                client.configureBlocking(false);            
                SelectionKeyHandler handler = new HttpConnection();
                SelectorManager.getSelectorManager().register(client, handler, SelectionKey.OP_READ);
            } 
        }  
        catch(IOException e) 
        { 
            logger_.warn(e);
        } 
    } 
}