UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2013-02-28 09:35 AM

fredson
Member
From: London, United Kingdom
Registered: 2012-12-12
Posts: 5
Website

Duplex Pipe

I'm having trouble in doing doing single pipe but the pipe should send and receive data in both sides? Anyone know how?

Offline

#2 2013-02-28 01:22 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: Duplex Pipe

Pipes are unidirectional, so you'd need two of them in order to get bidirectionality...  But, you can instead use an AF_UNIX socket, which serves as a fairly reasonable bidirectional pipe substitute...  Eg: just replace your pipe() call with socketpair()...

Offline

#3 2013-03-01 04:57 AM

fredson
Member
From: London, United Kingdom
Registered: 2012-12-12
Posts: 5
Website

Re: Duplex Pipe

RobSeace wrote:

Pipes are unidirectional, so you'd need two of them in order to get bidirectionality...  But, you can instead use an AF_UNIX socket, which serves as a fairly reasonable bidirectional pipe substitute...  Eg: just replace your pipe() call with socketpair()...

So it is really impossible to do in single pipe?

Offline

#4 2013-03-01 01:10 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,826
Website

Re: Duplex Pipe

Yes, unless your particular system happens to support bidirectional pipes...  I think a few systems might...  But, it's not standard...  Pipes are defined to be unidirectional...

Offline

Board footer

Powered by FluxBB