Common IV question: In what scenarios can a socket be shared between 2 processes
Background — a socket is a special type of file descriptor (at least in unix). Consider an output file handle. By default, this “channel” isn’t shared between 2 processes. Similarly, when a packet (say a price) is delivered to a given network endpoint, the kernel must decide which process to receive the data, usually not to two processes.
To have two processes both listening on the same network /endpoint/, one of them is usually a child of the other. The webpage in  shows a short python code illustrating this scenario. I tested. q(lsof) and q(ss) commands both (but not netstat) show the 2 processes listening on the same endpoint. OS delivers the data to A B A B…
https://bintanvictor.wordpress.com/2017/04/29/so_reuseport-socket-option/ shows an advanced kernel feature to let multiple processes bind() to the same endpoint.
For multicast (UDP only) two processes can listen to the same UDP endpoint. See  and 
A Unix domain socket can be shared between two unrelated processes.