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

View: 4167|Reply: 6

[Source] .NET/C# NamedPipe-based NamedPipe Cross-Process Communication [with Source Code]

[Copy link]
Posted on 7/16/2023 2:47:29 PM | | | |
Requirements: Two programs in the computer need one-way communication, and they don't want to use Socket and Http methods to communicate, Socket needs to listen to ports, and in case of port conflicts, they need to be resolved, and then they need to consider the reconnection mechanism, etc., the Http method is too inefficient, and will frequently establish and destroy TCP links. Then the AnonymousPipe anonymous pipeline requires a parent-child process, and doesn't take it into account.

Use named pipelines for inter-network process communication:The hyperlink login is visible.

Named pipelines provide inter-process communication between the pipeline server and one or more pipeline clients. They offer more functionality than anonymous pipelines, which are used to provide inter-process communication on the local machine. Named pipelines support full-duplex communication across networks and multiple server instances, message-based communication, and client emulation so that connection processes can use their own permission sets on remote servers.

Let's take a look at the renderings first:



Use PowerShell to view the named pipeline that is open (It is also possible to view it using a browser), the command is as follows:



.NET 6 as the command pipeline NamedPipeServerStream server, the code is as follows:

The .NET Framework program sends data as a NamedPipeClientStream client, with the following code:

Source code download:

Tourists, if you want to see the hidden content of this post, pleaseReply






Previous:ASP.NET MVC counts requests based on IHttpModule modules
Next:Base64 encoded string composition (what characters are in Base64)
Posted on 7/17/2023 12:11:47 AM |
Learn to learn
 Landlord| Posted on 7/20/2023 7:22:21 PM |
When the IIS application pool identity account is ApplicationPoolIdentity, the NamedPipeServer named pipeline cannot be accessed and the access is insufficient.

solution

.NET Framework project


.NET Core project



 Landlord| Posted on 7/20/2023 7:23:01 PM |
Posted on 7/25/2023 8:47:15 AM |
Very practical skill, must be obtained
Posted on 4/10/2024 5:31:24 PM |
This idea is good, I want to learn.
 Landlord| Posted on 8/11/2025 8:58:15 PM |
.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