From owner-freebsd-hackers Thu Mar 13 22:30:34 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id WAA01005 for hackers-outgoing; Thu, 13 Mar 1997 22:30:34 -0800 (PST) Received: from hamby1 (hamby1.lightside.net [207.67.176.17]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id WAA00999 for ; Thu, 13 Mar 1997 22:30:30 -0800 (PST) Received: (from jehamby@localhost) by hamby1 (SMI-8.6/SMI-SVR4) id WAA01171 for hackers@freebsd.org; Thu, 13 Mar 1997 22:30:27 -0800 Date: Thu, 13 Mar 1997 22:30:27 -0800 From: jehamby@lightside.com (Jake Hamby) Message-Id: <199703140630.WAA01171@hamby1> To: hackers@freebsd.org Subject: My pipe is getting muddled?! Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-MD5: Gxx8pU1Km1n59DqApDCStQ== Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Okay, I posted a question a while back about whether or not it would be okay to use SYSV message queues in a project. I got a mixed reaction on that, so I'm looking at FIFO's and/or sockets as well. I have one big problem, though: If I have a server sitting on a FIFO, and it needs to communicate in both directions with multiple clients (imaging something like the X server sitting on /tmp/.X11-pipe/X0), how do I keep everyone's messages from getting all mixed up? On a socket, one would sit in a loop and accept() connections on the server end, and everything just works. The thing is, I've been trying to figure out (using truss), how Solaris manages to do a very similar thing in the X server with FIFO's, and I can't for the life of me figure out what crazy STREAMS nonsense they're using. The nearest I can tell, there is some sort of multiplexor in there, because when a new client connects, the server does an ioctl(fd, I_RECVFD, &buf), and pulls a new file descriptor out of the stream, and communicates with the client on that. Oddly enough, the client isn't doing an I_SENDFD anywhere, so I think this is happening automatically. Can anyone explain what's going on? I believe /tmp/.X11-pipe/X0 is a new interface, because Solaris also has a /tmp/.X11-unix/X0, which I believe is how everyone else communicates? Any light you can shed on this will be appreciated. In the meantime, I'm going to start exploring UNIX-domain sockets, because they have the behavior I want. But I vaguely remember hearing that the Solaris method is faster (well, at least for Solaris :). TIA! -- Jake