Hello everyone, I'm trying to use named pipes to fuse a Python program and a C program. One side creates pipes using os.mkfifo() and both sides use the same named pipes (one side reads, another side writes). The read side uses select.select() to wait for incoming messages and read the message when select.select() says it is ready.
The length of the message is unknown to the read side. I cannot use file.read() because it will block waiting for an EOF. I cannot use file.readline() because how many lines have arrived is unknown. So, I needed to use os.read() with the exact number of characters to read. Under Solaris environment, os.fstat() provides the exact size of the message that has arrived. Thus, two processes can communicate each other through the named pipes without blocking. However, the above scheme didn't work under Linux. Linux os.fstat() returns size=0 even the message is pending. (I think Linux buffers the message in memory while Solaris buffers the message in a file system) My question is, how can I make the named pipe scheme work under Linux? Is there any way to read the message without getting blocked? I know this is more Linux question than Python question but I believe many Python programmers are strong Linux programmers. Any suggestions will be appreciated. Best regards, Aki Niimura -- http://mail.python.org/mailman/listinfo/python-list