sockets pipe multiple - example to explain unix domain socket - AF_INET vs AF_UNIX




1 Answers

AF_UNUX Sockets provide for great inter-process communication. Open a socket pair socketpair(..)" and bind to a temporary filename. Write to one of the pair arrives at the other. The kernel routes messages without protocol or filesystem overhead. One can use blocking i/o or select(...) to synchronize threads and processes in a FIFO manner. I like non-blocking with select and datagram (can get a length) mode but you can choose your own. Be sure to delete the temporary file on exit (it will have zero bytes but will still show up in the filesystem directory) jlp

clients how works

while I was reading for what AF_INET means, I learned that there is another family called UNIX domain socket. Here is the wiki link I read about this.

I do not understand what this means:

Unix domain sockets use the file system as their address name space. They are referenced by processes as inodes in the file system. This allows two processes to open the same socket in order to communicate. However, communication occurs entirely within the operating system kernel.

If I want to do SSH or FTP, what family do I use AF_INET or AF_UNIX. I am actually confused here a bit.




Related