Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jan 2000 09:12:31 -0800 (PST)
From:      "Brian D. Moffet" <brianm@moffetimages.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Performance issue with rfork() and single socketpairs versus multiple socketpairs.
Message-ID:  <200001251712.JAA41726@moffetimages.com>
In-Reply-To: <200001250124.BAA36765@hak.lan.Awfulhak.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Okay, stupid question.  socketpair returns 2 sockets which according to 
the man page are "indistinguishable".  Does this mean that you can read and
write to either socket pair?

pipe(2) returns 2 file descriptors, one of which is a read and one of
which is a write fd.  The other end flips these around, and data is not
mixed up that way.  One program cannot read and write to the same
file descriptor, with the expectation that the two ends of the pipe will
be able to properly communicate.

Will socketpair allow one program to read and write to the same file
descriptor (what I would call real "bi-directional")...  Like you can do
with a normal old socket?

Thanks
Brian

> > Use 'pipe(2)' rahter than 'socketpair(2)' as both are bidirectional and
> > pipe is a LOT faster.
>
> Although pipe(2)'s bi-directional capabilities are not standard (I've 
> been stung by this in the past :-()


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001251712.JAA41726>