Skip to content

Instantly share code, notes, and snippets.

@bowenwp
bowenwp / uds_socket_disconnect_demo.py
Last active September 19, 2025 19:05
Minimal Python UDS Disconnect Demonstration
"""
A minimal, sequential demonstration of UNIX Domain Socket (UDS) failure.
This script illustrates a common pitfall with datagram (SOCK_DGRAM) UDS sockets.
When a client uses `connect()` on a UDS socket, it doesn't connect to the
filesystem *path*, but rather to the underlying kernel object, which is
identified by its inode.
If the server process restarts and recreates the socket at the same path,
a new file with a new inode is created. The already-connected client, however,