473,581 Members | 2,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1602
In article <b0************ *************@p osting.google.c om>,
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.washingt on.edu
Jul 18 '05 #2

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

Similar topics

2
2436
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 "/opt/sfw/lib/python2.3/lib-tk/Tkinter.py", line 38, in ? import _tkinter # If this fails your Python may not be configured for Tk
1
6238
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. Only when the buffer becomes full does it resume execution. Here's my test code for reading from a pipe: //(compiled with g++ -std=c++98)...
6
1487
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 logged. To work correctly in a multi-threaded environment there are locks around the code which log the string. We could remove the locks and just...
17
1809
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 sun qsort gets a vector in which all elements are equivalent, my comparsion function raises SEGSEGV. The problem seems to be that all ...
2
1568
by: semut | last post by:
Any IDE for SunOS 5.8 C++ programming? open source or non open source. thanks
1
4235
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 read through all the threads I could find to solve this.) // iotest.cc // #include <iostream> using std::cin; using std::cout; using...
4
3950
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 char*. i need to test my method and for that i want to create a network buffer which will contain a packet of format as-> example of Configuration...
0
1431
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 char*const, const gdcm::Segment<unsigned char>*, std::less<const unsigned char*const>, std::allocator<std::pair<const unsigned char*const, const...
0
3852
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 string. write method should take a string. seek should take a number and return nuthing. use three member variables a buffer itself as a string,...
0
7868
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8149
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6553
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1138
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.