In a nutshell
A Unix domain socket serves as an endpoint for communication between processes running on the same machine. Each Unix domain socket is identified using a file system path (similar to regular files).
Create a socket
You can create a socket using the socket()
system call. This will return a file descriptor.
Connecting to a socket
You can use the connect()
system call to establish a connection to another process that’s listening on the same socket using the bind()
and listen()
system calls.
Sending messages via sockets
Once two processes have established a socket connection, they can data through the socket using the send()
and recv()
system calls.
View Unix domain sockets
See this post.