I preffer Named Pipes.
Most of the time i do this to communicate from C# to C++ Applications.
Simple example for creating Pipe in C++:
::CreateNamedPipe( PipeName, PIPE_ACCESS_DUPLEX, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 0, 0, (DWORD)-1, &MySA );
Reading from Pipe is as easy as reading from file:
HANDLE hPipe = CreateFile( _T("\\\\.\\pipe\\") + PipeName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL , NULL );
CString Buffer;
if( hPipe != INVALID_HANDLE_VALUE )
{
DWORD nNumRead;
BOOL bTmp = ::ReadFile( hPipe, Buffer.GetBuffer(1024), 1024, &nNumRead, NULL );
Buffer.ReleaseBuffer();
}
Sorry if the code don't machts 100% together.
I copyed the two code fragments out from two differend Projects.
But i think the principle is clear.