简体   繁体   English

是否可以连接两个管道/插座?

[英]Is it possible to connect two pipes/sockets?

I am wondering if it is possible to connect two pipes or socket. 我想知道是否可以连接两个管道或插座。 Lets suppose that have two pipes/socketpairs. 让我们假设有两个管道/插座对。 The first one has two file descriptors A and B, the second one has two file descriptors C and D. Is it possible to connect B to C to be able to write to A and read the data from D? 第一个具有两个文件描述符A和B,第二个具有两个文件描述符C和D。是否可以将B连接到C以便能够写入A并从D读取数据? Other then just reading form B and writing to C in user space? 除了阅读表格B并在用户空间中写入C之外,还可以吗?

Thanks. 谢谢。

If you simply want to read from one socket and write to another without copying the data to user-space, look at http://linux.die.net/man/2/sendfile . 如果您只是想从一个套接字读取并写入另一个套接字,而不将数据复制到用户空间,请查看http://linux.die.net/man/2/sendfile You need a fairly recent Linux. 您需要一个相当新的Linux。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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