If you use separate streams, you cannot read from the channel at the same time as you write to it. For example, if you make a lock that is read from a channel, and then a subsequent write lock (from another stream), then the write call will wait / block until the read call is completed, and in many cases, if this is an unexpected behavior, Your program will be stalled.
I have not tested overlapping I / O, but MAY be able to solve this problem. However, if you are configured to use synchronous calls, the following problems below will help you solve the problem.
Master / slave
You can implement a master / slave model in which the client or server is the master and the other end responds only to what you find in the MSDN examples.
In some cases, you may find this problem if the slave needs to periodically send data to the master. You must either use an external signaling mechanism (outside the channel), or the master must periodically request / interrogate the slave, or you can change the roles where the client is the master and the server is the slave.
Writer / Reader
You can use a writer / reader model in which you use two different pipes. However, you must connect the two pipes in some way if you have multiple clients, since each channel will have a different descriptor. This can be done if the client sends a unique identifier value when connected to each channel, which then allows the server to link the two channels. This number can be the current system time or even a unique identifier that is global or local.
Themes
If you are configured to use the synchronous API, you can use streams with the master / slave model if you do not want to be blocked while waiting for messages on the slave side. However, you will want to block the reader after he reads the message (or meets the end of a series of messages), then writes the answer (as a subordinate should) and finally unlocks the reader. You can lock and unlock the reader using locking mechanisms that make the thread sleep, as they would be most effective.
Security Issue with TCP
Loss coming from TCP instead of named pipes is also the biggest possible problem. The TCP stream does not contain any protection initially. Therefore, if security is a concern, you will have to implement this, and you have the opportunity to create a security hole, since you will have to handle authentication yourself. A named pipe can provide security if you set the parameters correctly. In addition, emphasize again: security is not a simple matter, and usually you need to use existing tools that were designed to provide it.