pipes

Is is possible to hold an anonymous pipe open forever?

I hava a Java programm that communicates with a C# console app through a pipe. In my dev environment it works like a charm but I am wondering if this is still reliable if the java app is running work days and weeks (It's for a POS Terminal). What I basically do is: write one line -> read one line. The C# Code is pretty simple static v...

Send timeouts on WAS-hosted WCF service with named pipe binding, per-call instancing

We have a client that sends requests to a per-call WCF service (WAS hosted, NP binding, same machine) in a loop. The WCF service calls an external EXE to process requests. The operations on the service can take a few seconds, or a few hours. To combat this, we have sendTimeout=00:01:00, receiveTimeout=00:05:00 and a built-in circuit-b...

Continously Read/Write Data with Pipes Win32

Hello, I am trying to write a GUI program for a command line program in Win32 using WinAPI (so please no MFC). In my current attempt, I am creating an input pipe and an output pipe to read/write data. However, my problem comes in when I attempt to continuously read from a program or to simply write after a single read due to the way I h...

Help with Asynchronous I/O

I have been doing a lot of searching and still can't seem to figure out how to fix my issue. I am writing a GUI program (in WinAPI so no MFC please) to communicate with another program (command line based). I am using anonymous pipes since everything is local (but perhaps named pipes would be better?) which then I use CreateProcess(); to...

Asynchronous I/O with Named Pipes WinAPI

Ok, I have asked a few questions about different facets of trying to accomplish what I want to do. This time I'm having big issues just reading from a named pipe. I think I have harvested enough information to possibly complete the project I am working on if I can set this up properly. I will include all relevant code below, but my missi...

Read Anonymous Pipes More than Once while Keeping Connection Open (WinAPI)

So I keep bouncing between named and anonymous pipes and here is my issue. I tried named pipes and they just didn't seem to work properly for what I wanted, so I'm back to anonymous pipes. However, the anonymous pipe needs to read input from a pipe (to a program that I did not create) and continuously read it as more information is avail...

Filehandle for Output from System Command in Perl

Is there a filehandle/handle for the output of a system command I execute in Perl? ...

WinAPI I/O Redirection - Read as Information is Available using Anon Pipes & Threads

I am creating an application which will read the output from another application (which I did not write) which sends its output to a command prompt. I need to be able to write this information an "Edit" dialog within my GUI program. I have accomplished this using anonymous pipes and multi-threading (a worker thread for writing and anothe...

making python programs "chat" via pipe

Hi! I'm trying to make two processes communicate using a pipe. I did this in the parent process: process = subprocess.Popen(test, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) process.stdin.write("4\n"); output = process.stdout.read() print output and in the child process: inp = raw_input() integer = int(inp) print int...

CreatePipe and necessary permissions in C#

Hello, I'm trying to add a Sokoban solver (written in C++) to my program in C# (I have got a class in my program that handles marshalling of C++ interface). My program loads solver.dll library which loads solver.exe. Solver.dll and Solver.exe communicate via pipes. The problem is that when I run my program in Visual Studio (debugging) ...

Python Popen: are the pipes in blocking mode? how can I put them in non-blocking mode?

Hi, In the subprocess documentation, I haven't found any hint if the pipes created by PIPE are blocking or non-blocking. I.e., if I call p.stdout.read(), will it block in certain circumstances? The documentation warns about that. How can I avoid that? Using p.communicate() is not an option for me because I don't want to block/wait unt...

what object-based shells are there?

I am planning to write an object-oriented shell (based on Python). I have many ideas already. But before I am going to implement it, I want to inspire me by some existing shell. What I basically mean by object-oriented: Parameters are not just an array of strings but an array of objects. The return value is also an object. There is no...

Send input to a program and get control back

Hello, I have been stuck on this for some time. Let's say I have a C program like the following. I want to be able to send this program some string and get the control after that. If I do: --> cat myfile | myprogram or --> echo "0123" | myprogram or --> myprogram < myfile I get the ouput (myfile contains "0123") 30 31 32 33 Usi...

How to capture stdout from another process in win32 without latency?

Hi ! What I'ld like to do is similar to what VS does in its output window or other editors in their tool windows: Start another process B from my process A and capture its stdout/stderr output. So far, I got it working with CreatePipe(), but for some reason, the output of B doesn't arrive at B right when it gets written. It behaves mor...

C fork/exec with non-blocking pipe IO

This seems to be a fairly common thing to do, and I've managed to teach myself everything that I need to make it work, except that I now have a single problem, which is defying my troubleshooting. int nonBlockingPOpen(char *const argv[]){ int inpipe; pid_t pid; /* open both ends of pipe nonblockingly */ pid = fork(); ...

find results piped to zcat and then to head

I'm trying to search for a certain string in a lot of gziped csv files, the string is located at the first row and my thought was to get the first row of each file by combining find, zcat and head. But I can't get them to work together. $find . -name "*.gz" -print | xargs zcat -f | head -1 20051114083300,1070074.00,0.00000000 xargs: zca...

Need help with named pipes and popen.

I've got a little C server that needs to accept a connection and fork a child process. I need the stderr of the child process to go to an already existing named pipe, the stdout of the child to go to the stdout of the parent, and the stdin of the child tp come from the same place as the stdin of the parent. My initial attempts involved...

What mechanism do PIPES use to "wake up" the recipient?

I have two questions is one here. On Windows, I am familiar with pipes and how they work. However, I am curious as to what mechanism the OS uses to notify the recipient thread of a message arrival. Does the thread "poll & sleep" continuously for data? Does the OS check to see if the thread is sleeping and wake it up? Or is there some o...

Using popen to write in a pipe only send data when pipe is closed

I'm using popen to open a write pipe and send commands to an application. The problem is that the commands are only sent to the application when I close the pipe. FILE * fp = open(target_app, "w"); fwrite(command, 1, command.size(), fp); getchar(); //wait for a key, because I don't want to terminate the application pclose(fp); // at thi...

Techniques for infinitely long pipes

There are two really simple ways to let one program send a stream of data to another: Unix pipe, or TCP socket, or something like that. This requires constant attention by consumer program, or producer program will block. Even increasing buffers their typically tiny defaults, it's still a huge problem. Plain files - producer program ap...