users@grizzly.java.net

Re: How does a grizzly-based server push to client just after accepting the client's connecting?

From: John ROM <snake-john_at_gmx.de>
Date: Sun, 15 Jun 2008 16:16:01 +0200

Hi Yi Bing,
you could override TCPSelectorHandler :

TCPSelectorHandler sh = new TCPSelectorHandler() {
            public boolean onAcceptInterest(SelectionKey key, Context ctx) throws IOException {
                SelectableChannel channel = acceptWithoutRegistration(key);

                if (channel != null) {
                    configureChannel(channel);
                    SelectionKey readKey =
                            channel.register(selector, SelectionKey.OP_WRITE);
                    readKey.attach(System.currentTimeMillis());
                }
                return false;
            }
        };


        sh.setPort(serverPort);
        controller.setSelectorHandler(sh);

Is that what you wanted?

many greetings

John

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser