Questions tagged [named-pipes]

A named pipe is an inter-process communication mechanism, which exists both on Unix and Unix-like systems (where it is also known as a FIFO and is file-like), and on Microsoft Windows (where it is an in-memory kernel object). The semantics and APIs differ substantially between the platforms.

Unix

On Unix and Unix-like systems a named pipe (also known as a FIFO for its behavior) is an extension to the traditional pipe concept, and is one of the methods of inter-process communication.

A traditional pipe is "unnamed" because it exists anonymously and persists only for as long as the process is running. A named pipe is system-persistent and exists beyond the life of the process and must be deleted once it is no longer being used. Processes generally attach to the named pipe (usually appearing as a file) to perform inter-process communication (IPC).

Windows

On Windows operating systems a named pipe is a named kernel object which provides duplex data transfers between two processes, a pipe server and a pipe client. Multiple completely independent instances of a particular named pipe object can be created, each connecting the pipe server to exactly one client. A pipe instance persists only as long as its server and client processes keep a handle referencing it.

Communication between the server and client via a pipe instance may be either stream-oriented or message-oriented.

1850 questions
20
votes
4 answers

Prevent FIFO from closing / reuse closed FIFO

Consider the following scenario: a FIFO named test is created. In one terminal window (A) I run cat test. It is now possible to write in window B and get the output in window A. It is also possible to terminate the…
Shump
  • 454
  • 1
  • 4
  • 11
20
votes
2 answers

C++: Implementing Named Pipes using the Win32 API

I'm trying to implement named pipes in C++, but either my reader isn't reading anything, or my writer isn't writing anything (or both). Here's my reader: int main() { HANDLE pipe = CreateFile(GetPipeName(), GENERIC_READ, 0, NULL, OPEN_EXISTING,…
Mike Pateras
  • 14,715
  • 30
  • 97
  • 137
19
votes
3 answers

Importing zipped CSV file into PostgreSQL

I have a big compressed csv file (25gb) and I want to import it into PostgreSQL 9.5 version. Is there any fast way to import zip or qzip file into postgres without extracting the file?
Arezoo
  • 452
  • 1
  • 5
  • 15
18
votes
1 answer

C# UnauthorizedAccessException when enabling MessageMode for read-only named pipe (NamedPipeClientStream class)

There's a problem with the NamedPipeClientStream class in .NET, in that you cannot create an instance of this class with PipeDirection.In, and then successfully change the ReadMode to PipeTransmissionMode.Message. Attempting to do so will raise an…
Roger Sanders
  • 2,232
  • 1
  • 22
  • 29
18
votes
2 answers

NamedPipeClientStream can not access to NamedPipeServerStream under session 0

I have NamedPipeClientStream which connects to NamedPipeServerStream. They exchange a couple of messages, and then NamedPipeClientStream closing, while NamedPipeServerStream recreated and continue listening for the client pipes. (I couldn't make a…
Ksice
  • 3,277
  • 9
  • 43
  • 67
17
votes
3 answers

Multithreaded NamePipeServer in C#

Hi I want to use NamedPipeServerStream which is new from .NET 3.5 for namedpipe communication. I want to write multi-threaded pipe server. is it handled by default or I should write code for that. my pipe server should handle multiple request at a…
Ehsan
  • 1,662
  • 6
  • 28
  • 49
17
votes
1 answer

How to use named pipes in C# correctly -- several connections, server recreation etc

I need to implement an inter-process communication between C# applications. I decided to use named pipes and wrote the following code: Server while (true) { using (var server = new NamedPipeServerStream("some_pipe")) { …
FrozenHeart
  • 19,844
  • 33
  • 126
  • 242
17
votes
3 answers

Best way to convert Stream (of unknown length) to byte array, in .NET?

I have the following code to read data from a Stream (in this case, from a named pipe) and into a byte array: // NPSS is an instance of NamedPipeServerStream int BytesRead; byte[] StreamBuffer = new byte[BUFFER_SIZE]; // size defined elsewhere…
Frank Hamming
  • 171
  • 1
  • 2
  • 6
17
votes
3 answers

Async two-way communication with Windows Named Pipes (.Net)

I have a windows service and a GUI that need to communicate with each other. Either can send messages at any time. I'm looking at using NamedPipes, but it seems that you cant read & write to the stream at the same time (or at least I cant find any…
steve cook
  • 3,116
  • 3
  • 30
  • 51
17
votes
4 answers

Should named pipes opened with mkfifo be closed and how?

I am using a named pipe to capture the output of an external program (wgrib2) within another program (MATLAB). The MATLAB code is below, and system() accesses the command line to make the pipe: system('mkfifo myfifo'); % Make a named pipe…
KAE
  • 815
  • 1
  • 13
  • 32
16
votes
6 answers

Using named pipes with bash - Problem with data loss

Did some search online, found simple 'tutorials' to use named pipes. However when I do anything with background jobs I seem to lose a lot of data. [[Edit: found a much simpler solution, see reply to post. So the question I put forward is now…
asoundmove
  • 1,292
  • 3
  • 14
  • 28
16
votes
1 answer

Is there any way to sniff named pipe traffic in Windows?

Is there any tool that can monitor/capture/sniff named pipe traffic? Even when max instance = 1?
est
  • 11,429
  • 14
  • 70
  • 118
16
votes
3 answers

C++ and C# Communication using Named Pipe

I'm trying to reverse enginering a dll injected into a process, that does hook winsock send() and send data over a PipeStream. This is the C# code that read the pipe stream: [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet =…
Fr0z3n
  • 1,569
  • 1
  • 18
  • 39
16
votes
12 answers

How to create a virtual file?

I'd like to simulate a file without writing it on disk. I have a file at the end of my executable and I would like to give its path to a dll. Of course since it doesn't have a real path, I have to fake it. I first tried using named pipes under…
Emmanuel Caradec
  • 2,302
  • 1
  • 19
  • 38
16
votes
10 answers

WCF NamedPipe CommunicationException - "The pipe has been ended. (109, 0x6d)."

I am writing a Windows Service with accompanying "status tool." The service hosts a WCF named pipe endpoint for inter-process communication. Through the named pipe, the status tool can periodically query the service for the latest "status." On my…
BTownTKD
  • 7,911
  • 2
  • 31
  • 47