in reply to make my code non block
I notice you're mixing IO::Select with buffered reads (<$rh>) and writes (print $ns). While you may sometimes be able to get away with this (there are POSIX rules, apparently, that let you), I would not rely on it.
When using select you should use sysread and syswrite (or send and recv, though you don't need the flags), as mentioned in the documentation for perldoc -f select and shown in the example code in the UDP Message Passing section of perlipc.
However, manually handling the buffers for all this can easily get tedious, so maybe you should look into an event system like Event or POE.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: make my code non block
by wavenator (Novice) on Oct 12, 2007 at 06:50 UTC |