From owner-freebsd-hackers Tue Jan 25 14:49:19 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from cr31617-a.lndn1.on.wave.home.com (cr31617-a.lndn1.on.wave.home.com [24.112.227.163]) by hub.freebsd.org (Postfix) with ESMTP id E0CFE15548 for ; Tue, 25 Jan 2000 14:48:02 -0800 (PST) (envelope-from jbailie@cr31617-a.lndn1.on.wave.home.com) Received: (from jbailie@localhost) by cr31617-a.lndn1.on.wave.home.com (8.9.3/8.9.3) id RAA03784; Tue, 25 Jan 2000 17:47:28 -0500 (EST) (envelope-from jbailie) Date: Tue, 25 Jan 2000 17:47:28 -0500 From: James Bailie To: "Brian D. Moffet" Cc: freebsd-hackers@freeBSD.org Subject: Re: Performance issue with rfork() and single socketpairs versus multiple socketpairs. Message-ID: <20000125174727.A3649@cr31617-a.lndn1.on.wave.home.co> References: <200001250124.BAA36765@hak.lan.Awfulhak.org> <200001251712.JAA41726@moffetimages.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <200001251712.JAA41726@moffetimages.com>; from brianm@moffetimages.com on Tue, Jan 25, 2000 at 09:12:31AM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, Jan 25, 2000 at 09:12:31AM -0800, Brian D. Moffet wrote: > 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? Yes sir. > 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. No, with a so-called bi-directional pipe, both ends are readable and writable, but bidirectional pipes are only found on certain systems. A traditional UNIX pipe is half duplex -- one way only. It's better to use socketpair() if you want full-duplex behaviour. Systems that have socketpair() can implement pipes using socketpair internally, so bidirectional pipes are usually just crippled UNIX-domain sockets in disguise. > 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? Yes. -- James Bailie http://members.home.net/jazzturk/main.html To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message