[ Team LiB ] Previous Section Next Section

15.9 Summary

Unix domain sockets are an alternative to IPC when the client and server are on the same host. The advantage in using Unix domain sockets over some form of IPC is that the API is nearly identical to a networked client/server. The advantage in using Unix domain sockets over TCP, when the client and server are on the same host, is the increased performance of Unix domain sockets over TCP on many implementations.

We modified our TCP and UDP echo clients and servers to use the Unix domain protocols and the only major difference was having to bind a pathname to the UDP client's socket, so that the UDP server had somewhere to send the replies.

Descriptor passing is a powerful technique between clients and servers on the same host and it takes place across a Unix domain socket. We showed an example in Section 15.7 that passed a descriptor from a child back to the parent. In Section 28.7, we will show an example in which the client and server are unrelated, and in Section 30.9, we will show another example that passes a descriptor from a parent to a child.

    [ Team LiB ] Previous Section Next Section