?
=?iso-8859-1?Q?Arnau_S=E1nchez?=
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
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