Unix ___domain socket: Difference between revisions

Content deleted Content added
More specific explanation
More specific working; added quote to citation
Line 17:
|year=2010
|isbn=978-1-59327-220-3
|page=1150}}</ref>, Unix [[computer program]]s that perform ''socket'' [[Inter-process communication|communication]] are similar. The only ''range of communication'' difference is the method to formconvert a name to the address parameter needed to ''bind'' the channel's connection. For a ''Unix ___domain socket'', the name is a <code>/[[Path (computing)|path]]/[[filename]]</code>. For an ''Internet ___domain socket'', the name is an <code>[[IP address]]:[[Port (computer networking)|Port number]]</code>. In either case, the name is called an ''address''.<ref name="lpi-p1150p1150_quote"/>{{cite book
|title=The Linux Programming Interface
|last=Kerrisk
|first=Michael
|publisher=No Starch Press
|year=2010
|isbn=978-1-59327-220-3
|quote=The server binds its socket to a well-known address (name) so that clients can locate it.
|page=1150}}</ref>
 
Two processes may communicate with each other if each obtains a socket. The server process ''binds'' its socket to an ''address'', opens a ''listen'' channel, and then continuously loops — [[Busy waiting|spin waiting]] for a client connection. Upon ''accepting'' a client connection, the server then executes a [[read (system call)|read]] [[system call]] that will [[Blocking (computing)|block wait]]. The client ''connects'' to the server's socket via the server's ''address''. The client process then [[write (system call)|writes]] a [[String (computer science)|message]] for the server process to read. The application's [[algorithm]] may entail multiple read/write interactions. Upon completion of the algorithm, the client executes <code>exit()</code><ref name="lpi-p1169">{{cite book