简体   繁体   中英

What is the NamedPipeServerStream and NamedPipeClientStream (s)?

I want to know why the NamedPipes exists in .Net and how could I benefit from them if I have an application that I want to create some kind of proxy to intercept its connection to its destination server.

What I want to achieve using NamedPipes is creating a proxy for Minecraft that intercepts the server-client connection and prints out the packets sent, received from and to the server for the packet learning purpose and for fun too...

[ Note ] I only asked that kinda wide question cause I did not yet have a project that I work on using the NamedPipes and the MSDN coverage of its topic is very mediocre.

Named pipes exist for inter-process communication on the same machine. Normally each console program has 2 predefined pipes: stdin (readable) and stdout (writable). In addition to them it is possible to create more pipes.

The purpose of NamedPipeServerStream is creating a new pipe, that can be consumed by client. Usually it is created when you need to provide some data to another process:

var myInputPipe = new NamedPipeServerStream("myinput", 
    PipeDirection.Out, 1, PipeTransmissionMode.Byte);

NamedPipeClientStream is used when you want to connect to existing pipe (usualy to read the data).

In your context (proxy for Minecraft) these classes are applicable if you want to create proxy for existing pipe; pipes are not suitable if you need to create a network proxy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM