How do sockets function as an IPC mechanism at the OS level?
Last updated
A socket is a bidirectional endpoint exposed as a file descriptor, with kernel send/receive buffers, defined by domain (
AF_UNIX,AF_INET) and type (SOCK_STREAM,SOCK_DGRAM).Unix domain sockets are same-host, path-addressed and fast (no network stack). Network sockets use IP + port and work across machines.
Server does
bind()/listen()/accept()and client doesconnect(). The result is full-duplex IPC between unrelated processes with one API from local to distributed.