7stud said:
a) The docs.
b) If the pipes were buffered then writing a small amount of data like
"text3" to the pipe would cause the other side to hang forever thereby
providing a possible explanation for the results.
That doesn't seem like a very good explanation, since the only thing
written to the file(i.e. stdin) was "text3", and the write() was
unbuffered, so the read() could consume all the data without the
write() closing the file--there was no more data.
[sigh].
So please explain how the receiving process mysteriously manages to look
inside your producer process to know that it is never going to produce
any more data. Let's (briefly) look at the docs for read():
"""
read( [size])
Read at most size bytes from the file (less if the read hits EOF before
obtaining size bytes). If the size argument is negative or omitted, read
all data until EOF is reached. ...
"""
I believe you omitted the argument. As I have explained, the read() call
therefore waits until the writer has closed the file. Which is what
makes the EOF indication appear.
And please stop dragging buffering into this as a red herring. You do
know what buffering *is*, I take it? The read() call buffers even an
unbuffered source, by definition.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd
http://www.holdenweb.com
Skype: holdenweb
http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------