Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Blocking read on pipes

Reply
Thread Tools

Blocking read on pipes

 
 
=?iso-8859-1?Q?Arnau_S=E1nchez?=
Guest
Posts: n/a
 
      07-15-2004
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non blocking socket keep blocking on read ? Serge Savoie Ruby 4 10-01-2008 03:16 PM
Non-blocking pipes during subprocess handling Tom Plunket Python 3 01-09-2007 10:53 PM
perl problem with select and non-blocking sysread from multiple pipes john Perl Misc 7 03-04-2005 02:34 PM
Pipes and non blocking writing Sébastien Cottalorda Perl Misc 2 04-20-2004 12:23 PM
Blocking and non blocking assignment in VHDL Hendra Gunawan VHDL 1 04-08-2004 06:03 AM



Advertisments