From owner-freebsd-hackers Sat Jan 30 16:48:10 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA15225 for freebsd-hackers-outgoing; Sat, 30 Jan 1999 16:48:10 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp04.primenet.com (smtp04.primenet.com [206.165.6.134]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA15220 for ; Sat, 30 Jan 1999 16:48:08 -0800 (PST) (envelope-from tlambert@usr04.primenet.com) Received: (from daemon@localhost) by smtp04.primenet.com (8.8.8/8.8.8) id RAA27931; Sat, 30 Jan 1999 17:47:58 -0700 (MST) Received: from usr04.primenet.com(206.165.6.204) via SMTP by smtp04.primenet.com, id smtpd027906; Sat Jan 30 17:47:52 1999 Received: (from tlambert@localhost) by usr04.primenet.com (8.8.5/8.8.5) id RAA27396; Sat, 30 Jan 1999 17:47:43 -0700 (MST) From: Terry Lambert Message-Id: <199901310047.RAA27396@usr04.primenet.com> Subject: Re: socketpair(2) To: howardjp@dragon.ham.muohio.edu (Jamie Howard) Date: Sun, 31 Jan 1999 00:47:42 +0000 (GMT) Cc: ckempf@enigami.com, freebsd-hackers@FreeBSD.ORG In-Reply-To: from "Jamie Howard" at Jan 30, 99 02:26:46 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Right, but it seems as though a UNIX domain socket will allow a process to > read off the socket that which it has just written, when bidirectional, > correct? (Or am I doing something wrong?) Use two socketpair's. > It would be nice if two connected processes could send data back and > forth without reading off their own output, and a TCP connection > implements this. (I think this is similar to a channel under Plan 9/Alef, > but I do not know for certain due to lack of access.) Depending on these semantics is bad, even if you make it work in your particular kernel. > Have I missed something here? Your best bet would be to bind to 127.0.0.1, and use the standard bind/list/accept/connect to get real sockets over the loopback interface. If you had a dire need, you could name the function that encapsulated the whole process "socketpair". Since the connect won't complete until the accept, you will need to fork a child to call connect. If you were moderately insane, you'd set up a socketpair(2) to pass the descriptor back to the parent, and then make the child exit so that it looked like a single process function with a lump in it. 8-). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message