unix domain socket VS named pipes?

后端 未结 2 1062
清歌不尽
清歌不尽 2020-12-07 09:01

After looking at a unix named socket and i thought they were named pipes. I looked at name pipes and didnt see much of a difference. I saw they were initialized differently

2条回答
  •  不思量自难忘°
    2020-12-07 10:03

    UNIX-domain sockets are generally more flexible than named pipes. Some of their advantages are:

    • You can use them for more than two processes communicating (eg. a server process with potentially multiple client processes connecting);
    • They are bidirectional;
    • They support passing kernel-verified UID / GID credentials between processes;
    • They support passing file descriptors between processes;
    • They support packet and sequenced packet modes.

    To use many of these features, you need to use the send() / recv() family of system calls rather than write() / read().

提交回复
热议问题