in reply to clashing sockets?

[Answer partially removed. I was thinking INET, not unix domain sockets]

If no process is sending something to this listening process (above) then the above script idles on recv line until it receives something again? How can I make it get out of the 'recv' cond to exec the count++?

Use select() to wait for data to become available on the socket. select() can be given a timeout so you can do your idle processing.

Replies are listed 'Best First'.
Re^2: clashing sockets?
by rhxk (Beadle) on Sep 07, 2004 at 22:48 UTC
    clashing in a sense of:
  • there's only 1 script that does the listening
  • and 2 or more clients simultaneously send a query to the listening process.
    would the script that listens be able to capture both of queries or 1 or none?


  • oh, by select you mean select((select(SERVER), $| = 1)[0]); ?

      Shoot, while trying to figure out what sockaddr_un does, I realise these are unix sockets! I can't help you with the clashing questions.

      And no, the other select in perlfunc: select RBITS,WBITS,EBITS,TIMEOUT, or its OO interface, IO::Select

        ahh...i found out that it won't clash. apparently, when you give a buffer size to the recv, it will record it in the buffer, and then execute it.