Very Confused: Named Pipes Problem

Byron Clark byron at theclarkfamily.name
Thu Jul 27 22:27:26 MDT 2006


On Thu, Jul 27, 2006 at 10:22:30PM -0600, Andrew McNabb wrote:
> That makes a lot of sense, but I still don't completely get it.
> 
> On Thu, Jul 27, 2006 at 10:07:57PM -0600, Byron Clark wrote:
> > 
> > It appears that you can't open a pipe for reading unless it's been
> > opened for writing already.
> 
> It would seem that the "best" way to write this would be:
> 
> nc -v www.mcnabbs.org 80 >$FIFO2 <$FIFO1 &
> ./httpget.sh >$FIFO1 <$FIFO2
> 
> since each command opens a fifo for writing as quickly as possible and
> waits as long as possible before opening a fifo for reading.
> 
> However, it seems to hang when I do it this way.  What am I missing?

Sorry, that was a mistake in the explanation.  open(2) for reading _or_
writing on a pipe will block until open(2) is called on the other end of
the pipe.

So, the only thing that matters is that you open the pipes in the same
order for both commands.

--
Byron Clark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://plug.org/pipermail/plug/attachments/20060727/f3f04059/attachment.pgp


More information about the PLUG mailing list