in reply to Re: Printing to all clients on a socket from a child process
in thread Printing to all clients on a socket from a child process

Have you got any suggestions on where I place my keep alive in the parent? I explored this route but always got stuck as the Keep Alive would never end.
  • Comment on Re^2: Printing to all clients on a socket from a child process

Replies are listed 'Best First'.
Re^3: Printing to all clients on a socket from a child process
by pc88mxer (Vicar) on Mar 11, 2008 at 21:32 UTC
    I would just do it in your I/O processing loop. At the end of the loop, just check if it is time to send the keep-alive message. You can keep track of things on a per-client basis, or just use the same timing for all clients.

    In your can_read call, you'll want to use a timeout value that's equal to your keep-alive period so that you won't miss sending out a keep-alive message on time.