套接字对和成对的未命名管道之间有什么区别吗? [英] Is there any difference between socketpair and pair of unnamed pipes?

查看:136
本文介绍了套接字对和成对的未命名管道之间有什么区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不仅想了解用户方面的差异,还想知道Linux内核实现中的差异/常见部分.

I would like to know not only user-side differences, but differences / common parts in Linux kernel implementation as well.

推荐答案

  • 管道是单向的,因此需要两个管道进行双向通信,而套接字对是双向的.

    • pipes are unidirectional, so you need two pipes to have bidirectional communication, whereas a socketpair is bidirectional.

      管道始终面向流,而套接字对则面向数据报.

      pipes are always stream-oriented, whereas socketpairs can be datagram-oriented.

      套接字对是普通的 AF_UNIX 套接字,这意味着可以通过它们传递辅助消息,例如 SCM_RIGHTS SCM_CREDENTIALS .p>

    • socketpairs are normal AF_UNIX sockets, which means that ancillary messages like SCM_RIGHTS and SCM_CREDENTIALS can be passed over them.

      在内核中,管道在文件系统代码中实现,套接字对在网络代码中实现.

      In the kernel, pipes are implemented in the filesystem code and socketpairs in the networking code.

      这篇关于套接字对和成对的未命名管道之间有什么区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆