What is a Unix domain socket?
9 April 2023 (Updated 11 August 2024)
In a nutshell
A Unix domain socket is 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.
Other notes
- All read and write operations on a Unix socket is done in memory.
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment