how to manage connections?

kirtimaan.mg kirtimaan.mg at gmail.com
Mon Nov 22 01:37:13 EST 2010


You can create and manage an array of connections. In your main class you
can create a static array and in your handler's connection/disconnection
event, you can add / remove channel to that array (use synchronized).  



Thanks

 

 

-------Original Message-------

 

From: falconair [via Netty Forums and Mailing Lists]

Date: 11/22/2010 5:13:47 AM

To: kirtimaan.mg

Subject: how to manage connections?

 

Say I have a simple server: 



final ServerChannelFactory cf = ... 

final ServerBootstrap server = new ServerBootstrap(cf); 

server.bind(...); 



How can I get a list of all clients currently connected (perhaps their
remote address and the  time at which they first connected)? 



My specific protocol has a unique ID associated with each connection.  How
can I get a connection by ID and, say, kill it?  How can I ensure the same
ID is not used by multiple connections? 



In each of those cases, a data structure needs to be accessed both, inside
and outside connection pipelines.  Should I just pass in a thread safe data
structure to each of my handlers, which then update it with relevant
information (their own ID for example)?  Is there a more standard way of
doing this? 



Thanks 









View message @ http://netty-forums-and-mailing-lists.685743.n2.nabble
com/how-to-manage-connections-tp5761250p5761250.html

To start a new topic under Netty User Group, email
ml-node+685700-1479029216-303201 at n2.nabble.com 

To unsubscribe from Netty User Group, click here. 

 
 
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/how-to-manage-connections-tp5761250p5761740.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list