Buffer problem on SunOS

Donn Cave donn at u.washington.edu
Mon Nov 22 12:30:13 EST 2004


In article <b012e8e5.0411220705.a870a66 at posting.google.com>,
 gaool at caramail.com (gaool) wrote:
...
> If the responses of the send command are big, it fill the buffer and I
> can see as much lines of the response as the buffer size. And I don't
> see the rest of my response.
> 
> Apparently, it doesn't depend on the buffer size argument of Pipedream
> module.
> 
> In fact, it seems that there is a SunOS buffer but I don't know its
> size and what I have to do to set it or to delete it.

I'm not acquainted with this "Pipedream" module, but you may
be interested to know that the UNIX operating system provides
a system level read(2) function that does not buffer any input.
If you apply this function to a pipe file descriptor, it will
return with whatever data was in the pipe, or block if there
is no data.  That function is available in the posix module,
a.k.a. os module.

There's a pretty good chance however that it won't help, because
the data is indeed sitting in a buffer on the other side of the
pipe.  That isn't a SunOS buffer per se, except inasmuch as it's
provided by the C stdio library functions that your application
probably calls for output.  If it can be rewritten to flush its
output regularly, that will help.  Otherwise the only thing you
can do is try to create a "pseudotty" instead of a pipe, because
standard buffering policy changes to line buffered on a tty.
There are modules for this, but you may find an openpty() function
in the posix module that will work for your purposes.  In any case
this is not a simple solution, nor a cheap one in terms of system
resources.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list