I want to implement a "named pipe" for exchanging double arrays between a C# and a Python process does anyone know about that?
I find some code but I can't understand
I want to implement a "named pipe" for exchanging double arrays between a C# and a Python process does anyone know about that?
I find some code but I can't understand
[DllImport("kernel32.dll")]
static extern unsafe int CreateNamedPipe(
string lpName, uint dwOpenMode, uint dwPipeMode,
uint nMaxInstances, int nOutBufferSize,
int nInBufferSize, int nDefaultTimeOut,
ref SECURITY_ATTRIBUTES lpSecurityAttributes
);
[DllImport("kernel32.dll")]
static extern unsafe int ConnectNamedPipe(
int hNamedPipe,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
static extern unsafe int DisconnectNamedPipe(
int hNamedPipe
);
[DllImport("kernel32.dll")]
static extern unsafe int WriteFile(
int hFile, void* lpBuffer,
int nNumberOfBytesToWrite,
int* lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
static extern unsafe int ReadFile(
int hFile, void* lpBuffer,
int nNumberOfBytesToRead,
int* lpNumberOfBytesRead,
ref OVERLAPPED lpOverlapped
);
[DllImport("kernel32.dll")]
static extern unsafe int CloseHandle(
int hObject
);
A:
This method is for communicating with a separate process using a Windows named pipe. If you want to communicate between two threads in the same process (or between two processes on the same machine), you would use a MemoryMappedFile
or P/Invoke
CreateFileMapping
and MapViewOfFile
.