Sorry, this probably really is more a general unix/linux problem than
a perl issue but I couldn't find any more suitable place to ask:

I am trying to figure out a way to write data to a fifo without
knowing whether there is a reader available and without ever blocking.
What I'd like is somthing like this:

sysopen(FIFO, $fifo, O_NONBLOCK|O_WRONLY)
              or die "Can't open fifo $fifo: $!\n";
...;

while (my $bytes=sysread(IN,$buf,$block_size)) {
            if ($fifo) {
               # do other stuff:
               ...;
               # write in case somebody cares to read:
                syswrite(FIFO, $buf);
            }
}

Unfortunately, the open fails unless there is somebody reading from
the fifo- It is possible to open a fifo for read without blocking, but
I couldn't find any way to do this for writing. For reading, it also
seems to be possible to ge a signal if data is available, but I can't
think of any way to get such a signal if the pipe is opened for
reading (so I could afterwards open it for writing).

Ainy ideas?

Regards,
                Peter Daum



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to