Hi,
in Grizzly 2.0 you can implement Filter's onAccept method to get
notified, when new connection gets accepted. Please take a look at
lifecycle filter implementation from this sample [1].
WBR,
Alexey.
[1]
https://grizzly.dev.java.net/source/browse/grizzly/branches/2dot0/code/samples/framework-samples/src/main/java/com/sun/grizzly/samples/lifecycle/
On Oct 2, 2009, at 22:08 , dentz wrote:
>
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>