Reputation: 3512
What happens when I attempt to use a NamedPipeServerStream
class object to transfer 1GB of data by calling its Write()
method? Especially if the data is not immediately consumed by a client. Where is the data held?
What are good techniques for transferring large amount of data using pipes? Split it into smaller chunks and implement some communications protocol?
Are there better alternatives to pipes? I would like to avoid writing to hard disk.
Upvotes: 1
Views: 2893
Reputation: 8466
You can use memory mapped files for these sort of things. They work really well for IPC. See here.
I assumed your processes communicate inside the same machine.
EDIT: Or you could just go for sockets.
EDIT: I had some implementation using named pipes and wasn't very stable, so I gave up on it, switching to memory mapped files. If you still wish to stick with named pipes, you could split your load into chunks which could be prepended by a header with some relevant information (like chunk size, chunk index, total chunks count, etc...) and then expect for a confirmation from the client before writing the next chunk.
Upvotes: 1