In the file namespace, socket addresses are file names. You can specify any file name you want as the address of the socket, but you must have write permission on the directory containing it. In order to connect to a socket, you must have read permission for it. It's common to put these files in the `/tmp' directory.
One peculiarity of the file namespace is that the name is only used when opening the connection; once that is over with, the address is not meaningful and may not exist.
Another peculiarity is that you cannot connect to such a socket from another machine--not even if the other machine shares the file system which contains the name of the socket. You can see the socket in a directory listing, but connecting to it never succeeds. Some programs take advantage of this, such as by asking the client to send its own process ID, and using the process IDs to distinguish between clients. However, we recommend you not use this method in protocols you design, as we might someday permit connections from other machines that mount the same file systems. Instead, send each new client an identifying number if you want it to have one.
After you close a socket in the file namespace, you should delete the
file name from the file system. Use
do this; see section Deleting Files.
The file namespace supports just one protocol for any communication
style; it is protocol number
Go to the first, previous, next, last section, table of contents.