in reply to UDP and IO::Socket

Well, you could have your server write a sleep.pid file when it gets a request in.
If the next request gets a response from calling kill 0, server.pid; then it doesn't start another instance. Thats what I do to stop initiating multiple instances of remote servers.

Replies are listed 'Best First'.
Re: Re: UDP and IO::Socket
by toadi (Chaplain) on Jan 15, 2002 at 21:12 UTC
    It's not it doesn't start multiple instances when it's running. That I have solved. But when the client connects ten times, the 10 connects keep on waiting in the queue and my sleep will be run 10 times consecutive.

    --
    My opinions may have changed,
    but not the fact that I am right

      Then you need to provide a slightly more complex server instance, that is a multiplexed reader. This will not wait for individual actions to complete and will allow you to close incoming reads if the sleep script is currently running yet respond to any read if sleep has finished?
      while (1) { ($read, $write, $err) = IO::Select->select($sockin, $sockout, $sock +err, 1); for $sock (@$read) { $sock->recv($data, 1024 * 64, 0); next if $! == EAGAIN() || $! == EWOULDBLOCK(); next if (-e 'server.pid'); system ('./sleep.pl'); } }
        See where you are getting at, but the documentation if IO::Select is to sparse to understand your example. Can you give some more info?

        --
        My opinions may have changed,
        but not the fact that I am right