UNIX domain sockets vs FIFOs

Is there a performance advantage of one of these over the other? Obviously, it makes no sense to use normal TCP sockets or UDP sockets w/ the overhead they carry. But what about UNIX domain sockets vs FIFOs? I'd think they'd be very similar, in terms of performance and in terms of how they're manipulated.

I plan on doing non-blocking I/O on these and using select to decide when to read an interface.

Thanks,

Matt Gessner

They are not interchangable the way pipe() and socketpair() are. Compared to FIFO's, Unix domain sockets are a minor nightmare to use. Two programs can just open a FIFO and then they are talking. With Unix domain sockets, a server has to set up one unix domain socket and go through all the networking business. A client creates a temporary unix domain socket of its own and connects to the servers socket. The server then forks() and starts a conversation with the client. There is a lot of overhead including a fork() just to get the ball rolling. Ignoring the startup overhead, I'm not sure which can send data the fastest. I would go with the FIFO anyway.

But it's good to use Unix domain sockets at least once, so maybe you should do that. That will cure you forever from considering them again.

^^Heh^^ There's a sad story there. :wink:

I don't find unix domain sockets that terrible to use and they are still the best local way of bidirectional communication and concurrent data access between many processes.