Unix Sockets

An Engineer. Speaks on Architecture, backend engineering, cloud-native, virtualization, and scheduling. http://rmtsbus.in (Head). Likes Sparkling water and 🍉
Socket addressing allows you to do interprocess communication. Unix domain sockets increase efficiency by bypassing the operating system’s network stack, eliminating the overhead of traffic routing.
Types
Stream Sockets (SOCK_STREAM):
Stream sockets provide a connection-oriented, reliable, two-way communication channel between processes.
This type of socket is typically used with the Transmission Control Protocol (TCP) for reliable data transmission.
Communication occurs in a continuous stream of bytes, preserving message boundaries.
Datagram Sockets (SOCK_DGRAM):
Datagram sockets provide connectionless, unreliable communication between processes.
They are commonly used with the User Datagram Protocol (UDP), where messages are sent in discrete packets called datagrams.
Datagram sockets do not guarantee the delivery or ordering of messages, making them suitable for applications where low overhead and speed are prioritized over reliability.
Raw Sockets (SOCK_RAW):
Raw sockets allow applications to directly access lower-level network protocols, such as IP, ICMP, or ICMPv6.
They provide full control over the packet headers, allowing applications to implement custom protocols or perform low-level network tasks.
Raw sockets are typically used for network diagnostic tools, protocol development, or network sniffing applications.
Sequential Packet Sockets (SOCK_SEQPACKET):
Sequential packet sockets provide a connection-oriented, reliable communication channel similar to stream sockets.
However, they preserve message boundaries like datagram sockets, ensuring that the data sent by one peer will be received as a whole message by the other peer.
Sequential packet sockets are not as commonly used as stream or datagram sockets but can be useful in certain scenarios where message boundaries are critical.