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, please Reply
|