I’m developing an application with a team in .Net (C++) and provide a COM interface to interact with python and other languages.
What we’ve found is that pushing data through COM turns out to be pretty slow.
I’ve considered several alternatives:
- dumping data to a file and sending the file path through com
- Shared Memory via mmap?
- Stream data through a socket directly?
From your experience what’s the best way to pass around data?
Staying within the Windows interprocess communication mechanisms, we had positive experience using windows named pipes. Using Windows overlapped IO and the
win32pipemodule from pywin32.You can learn much about win32 and python in the Python Programming On Win32 book.
The sending part simply writes to
r'\\.\pipe\mypipe'.A listener (
ovpipe) object holds an event handle, and waiting for a message with possible other events involves callingwin32event.WaitForMultipleObjects.Here is part of the python overlapped listener class: