470,636 Members | 1,555 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

Blocking read on pipes

Hello,

I have a problem when reading from stdin (using it as pipe) in a Python program (the sender
is written in C):

C (sender)
write(1, buffer, 4)

Python (recv.py)
sys.stdin.read(256) or sys.stdin.read()

sender | recv.py

Python's read blocks the program because the written buffer length (4) is lower than the indicated
in read function (256), but when I do the same with C (read(0, buffer, 256)) it is not blocking,
just
returns the four bytes. That is what I need.

I've tried to flush the stdout in the sending program, but it does the same.

any ideas?

thanks,
arnau

Jul 18 '05 #1
0 1015

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Christian Hammers | last post: by
4 posts views Thread by Jonathan Fine | last post: by
2 posts views Thread by Robin Becker | last post: by
13 posts views Thread by j. del | last post: by
3 posts views Thread by Mario | last post: by
6 posts views Thread by placid | last post: by
3 posts views Thread by Tom Plunket | last post: by
12 posts views Thread by puzzlecracker | last post: by
5 posts views Thread by Thomas Christensen | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.