Windows Mailslot - _best_

Note : The 424-byte limit for network mailslots is critical; larger messages fail with ERROR_BAD_NETPATH or ERROR_INVALID_PARAMETER . 4.1. Server (Creates mailslot, reads messages) #include <windows.h> #include <iostream> int main() HANDLE hMailslot = CreateMailslot( "\\.\mailslot\MyMailslot", 0, // no message size limit MAILSLOT_WAIT_FOREVER, NULL ); if (hMailslot == INVALID_HANDLE_VALUE) return 1;

CloseHandle(hMailslot); return 0; #include <windows.h> #include <iostream> int main() HANDLE hFile = CreateFile( "\\.\mailslot\MyMailslot", GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if (hFile == INVALID_HANDLE_VALUE) return 1; windows mailslot

char buffer[512]; DWORD bytesRead; while (ReadFile(hMailslot, buffer, sizeof(buffer)-1, &bytesRead, NULL)) buffer[bytesRead] = '\0'; std::cout << "Received: " << buffer << std::endl; Note : The 424-byte limit for network mailslots