Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Oct 2012
Offline Last Active Sep 11 2014 07:25 AM

#5147017 My sockets are as fast as pipes..

Posted by on 14 April 2014 - 05:23 PM

Thanks for the insightful comments!

So if I understood correctly, using shared memory is the solution. But still no guarantee for a speed increase.

I'll try my hands on this, thanks again

#5146956 My sockets are as fast as pipes..

Posted by on 14 April 2014 - 12:47 PM



For an IPC I used sockets for a long time. That's convenient and relatively fast.

Then I thought, at least when the 2 processes are on the same machine, that I could gain speed by using pipes instead. My idea of pipes was that they were using shared memory. But it turns out that my pipe communication is as slow as my socket communication. How can that be? Am I doing something wrong?


Currently, I have implemented the pipes on Windows, but if I can obtain a speed increase, I also want to do this on Linux.


Here my pipe implementation, client side:

// connect to an existing pipe:
HANDLE pipe=CreateFile("\\\\.\\Pipe\\myPipe",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0);

// Write something:
DWORD bytesWritten;

// Read something:
DWORD bytesRead;

And here my pipe implementation, server side:

// Create the pipe:

// Connect to client:

// Read and write from client is implemented in the same was as for the client read/write routines

Anything I am doing wrong?