Date: Thu, 13 Mar 1997 22:30:27 -0800 From: jehamby@lightside.com (Jake Hamby) To: hackers@freebsd.org Subject: My pipe is getting muddled?! Message-ID: <199703140630.WAA01171@hamby1>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703140630.WAA01171>