Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Buffer problem on SunOS

Reply
Thread Tools

Buffer problem on SunOS

 
 
gaool
Guest
Posts: n/a
 
      11-22-2004
Hello,

I wrote a python script (python 2.3.3) to send some commands to a
programm and to show on the screen the responses of this programm. I
use "Pipedream.py" module in my script to speak with the programm
(under unix system, it uses fdopen() to create a pipe and to send the
specified string. fdopen has a buffer size argument).So I can specify
a buffer size when I send a command with the pipedream module.

On windows it works but on SunOS I have a buffer problem (may be it
would be te same on other unix system...). I don't see the response of
my program before the buffer (which buffer?) is full.

I tried to put differents values for the buffer size argument of the
Pipedream object:
0 (which means unbuffered), 1 (line buffered), and other values (which
create a buffer with the size of the specified value).

But it's always the same thing: if the responses of the program are
short, nothing append. I have to send a lot of commands to full the
buffer. And then I can see all the responses of the commands I send
before and the last response of the last send command.

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.

If you have any idea...

Best regards.
 
Reply With Quote
 
 
 
 
Donn Cave
Guest
Posts: n/a
 
      11-22-2004
In article <> ,
(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,
 
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
Problem using net/ftp om SunOS 5.8 - libgcc_s.so.1 not found Ben Edwards Ruby 0 06-14-2007 08:47 AM
Socket problem -- response slow for host with domain (on SunOS 5.8) Nishi Bhonsle Java 17 09-27-2004 09:18 PM
Problem with Python and _tkinter on SunOS system gaool@caramail.com Python 2 09-16-2004 06:53 AM
Problem building XML::LibXML on SunOS 5.6 Iain Perl Misc 0 12-16-2003 05:42 PM
Performance problem on SunOS 5.8 kielhd Perl Misc 5 11-26-2003 01:49 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57