Re: Force all PoCo::Server::TCP clients to disconnect

[email protected] (Rocco Caputo) Wed, 7 Sep 2011 23:32:38 -0400
Newsgroups perl.poe
Message-ID <[email protected]>
You need to keep track of all the TCP connections.  http://poe.perl.org/?POE_Cookbook/Chat_Server shows how to do it.  Instead of broadcasting messages to all attached clients, though, you would be broadcasting a "shutdown" event.

-- 
Rocco Caputo <[email protected]>


On Sep 5, 2011, at 13:47, Gunnar Strand wrote:

> Hi,
> 
> I have a TCP server with persistent client connections which are not
> expected to disconnect. I want to be able to bring down the
> PoCo::Server::TCP, but sending "shutdown" makes a graceful client shutdown,
> waiting for persistent connections to close. I've not found any way to tell
> the TCP server PoCo to perform the disonnect on the server side, and the
> client sessions  My application does not keep track of connected client
> sessions.
> 
> According to POE::Kernel, doing:
> 
> $_[KERNEL]->signal( $_[KERNEL], 'shutdown' );
> 
> should broadcast the shutdown event to all sessions, but it doesn't seem to
> close the client sessions.
> 
> Do I need to keep track of all client sessions myself? I want to restart the
> server occasionally and want it to exit on INT or TERM signals - perhaps I
> am attacking this in the wrong way?
> 
> BR
> Gunnar