473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Buffer problem on SunOS

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.
Jul 18 '05 #1
1 1590
In article <b0*************************@posting.google.com> ,
ga***@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, do**@u.washington.edu
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: gaool | last post by:
Hello, I try to launch a Python script on SunOS system but I have this error: """Traceback (most recent call last): File "ihm1_1.py", line 3, in ? from Tkinter import * File...
1
by: inkapyrite | last post by:
Hi all. I'm using ifstream to read from a named pipe but i've encountered an annoying problem. For some reason, the program blocks on reading an ifstream's internal buffer that's only half-filled....
6
by: nickdu | last post by:
I usually try to stay away from _alloca(). However, I'm considering using it for a logging function. Our current logging function maintains its own buffer which it grows to fit the string being...
17
by: arne.muller | last post by:
Hello, I just had to find out that a program that runs fine under linux and True64 alpha crashed with a segmentation fault under SunOS 5.8. I drilled down and it appears that if the ...
2
by: semut | last post by:
Any IDE for SunOS 5.8 C++ programming? open source or non open source. thanks
1
by: dkhosh | last post by:
The following code works on SunOS but not on MacOS X. On the Mac, the second "cout <<" prints to the screen but the program quits without getting any input. Can anyone explain this? Thanks. (I've...
4
by: aki | last post by:
Hi all, i am writing codes for implementing network protocols. i have written a method which is receiving a packet from network. i have assumed that the packet i will receive will be of type...
0
by: mathieu | last post by:
Hello, I am struggling with the following error on a SunOS C++ compiler: "/opt/SUNWspro/prod/include/CC/Cstd/./map", line 251: Error: Multiple declaration for std::map<const unsigned...
0
by: martinmercy2001 | last post by:
Could any body help me with creating a ring buffer class using a string. use memory circular buffer not an IO buffer. just read, write and seek method. Read method should take anumber and return the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.