This article is a mirror article of machine translation, please click here to jump to the original article.

View: 910|Reply: 1

[Source] .NET/C# parent-child processes communicate using MemoryMappedFile

[Copy link]
Posted on 2025-4-2 09:10:46 | | | |
Requirements: Start a process using the C# main console, the main process passes data to the child process, and the child process processes it, and then returns the data to the main process. Communicate with a MemoryMappedFile memory-mapped file.

Other ways

.NET/C# NamedPipe-based NamedPipe Cross-Process Communication [with Source Code]
https://www.itsvse.com/thread-10628-1-1.html

.NET/C# implements program singleton based on Mutex and MemoryMappedFile
https://www.itsvse.com/thread-10808-1-1.html

.NET/C# parent-child processes communicate using standard input/output streams
https://www.itsvse.com/thread-10982-1-1.html

Idea: The main process creates a MemoryMappedFile memory mapping file, which is divided into 2 blocks, the first is the input and the second is the output. It can also be understood as the first space to write to the main process to read to the subprocess, and the second space to write to the subprocess to read the main process.

The code is as follows:


The renderings are as follows:



Reference:

The hyperlink login is visible.
The hyperlink login is visible.




Previous:.NET/C# parent-child processes communicate using standard input/output streams
Next:Use the open-source tool Restic Incrementally back up disk files
 Landlord| Posted on 2025-8-11 20:58:01 |
.NET/C# processes communicate between gRPC and Unix domain sockets
https://www.itsvse.com/thread-11051-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com