Home:ALL Converter>Benefits on using UNIX named pipes instead of TCP sockets, in Linux?

Benefits on using UNIX named pipes instead of TCP sockets, in Linux?

Ask Time:2020-07-09T09:45:43         Author:onlycparra

Json Formatter

Everywhere I read about named pipes vs sockets, I see that a socket can do what a named pipe can, and more. I am guessing that pipes may be faster because they are simpler, but I haven't find it explicitly anywhere.

In Linux, is there any advantage in using named pipes instead of sockets?

Thanks for your help and time.


EDIT: I found some comparisons here, but these are UNIX-sockets (a.k.a. UNIX domain sockets), which based on this, I understand they are a different creature.

Therefore, I clarify: I am asking about TCP sockets versus Unix named pipes (because MS Windows has another thing called "named pipes", but they seem to be functionally more similar to UNIX domain sockets).

At this point, it looks more likely to me that UNIX named pipes are faster than TCP sockets, but I would like to know some technicalities on why that would the case, and other potential benefits.

Author:onlycparra,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/62806136/benefits-on-using-unix-named-pipes-instead-of-tcp-sockets-in-linux
Evert :

This is likely an imperfect answer, but here's what I know.\nSending data over a TCP socket means that the transmission needs to through your networking system, will get a source & destination IP, split up in a maximum of 64K packets. Packaged in both a TCP and IP envelope, potentially go through firewall rules. The receiver also needs to acknowledge packages, make sure they arrive in order and there needs to be a negotation in place in case packages get lost and need to be re-sent.\nSending data in a named pipe more or less works like just writing to a file descriptor like STDOUT, and reading from STDIN.\nGoing through the network stack (even if it's just localhost) simply has a lot more layers and complexity. The system that can send a message reliably to the other side of the world needs that, but a simple local named pipe does not.",
2020-07-09T02:27:59
yy