How do I unbind a server socket once I call bind()

dbevenius daniel.bevenius at gmail.com
Mon Mar 9 06:46:49 EDT 2009


Hi Virat,

bootstrap.bind returns a channel which you can then call close() on:
Channel sc = bootstrap.bind(new InetSocketAddress(PORT));
sc.close().awaitUninterruptibly();

Atleast this is what I've been doing and this works for me.

Regards,

/Daniel

2009/3/9 Virat Gohil (via Nabble)
<ml-user+190262-330470430 at n2.nabble.com<ml-user%2B190262-330470430 at n2.nabble.com>
>

> Hi All,
>
> I have created a ServerSocketChannelFactory as follows:
>
> factory = new
> NioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool(),numHandlerThreads);
> bootstrap = new ServerBootstrap(factory);
> bootstrap.bind(new InetSocketAddress(PORT));
>
> My question is, how do I unbind the port when shutting down my server.
>
> Thanks in advance!
>
> Virat
>
> _______________________________________________
> netty-users mailing list
> netty-users at ...<http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2448201&i=0>
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>
> ------------------------------
>  View message @
> http://n2.nabble.com/How-do-I-unbind-a-server-socket-once-I-call-bind%28%29-tp2448201p2448201.html
> To start a new topic under Netty User Group, email
> ml-node+685700-269084044 at n2.nabble.com<ml-node%2B685700-269084044 at n2.nabble.com>
> To unsubscribe from Netty User Group, click here< (link removed) ==>.
>
>
>

-- 
View this message in context: http://n2.nabble.com/How-do-I-unbind-a-server-socket-once-I-call-bind%28%29-tp2448201p2448307.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list