Michal Pietras
Michal Pietras

Reputation: 442

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? Other then just reading form B and writing to C in user space?

Thanks.

Upvotes: 0

Views: 2956

Answers (1)

John Zwinck
John Zwinck

Reputation: 249153

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 . You need a fairly recent Linux.

Upvotes: 2

Related Questions