Closed yaobinwen closed 1 year ago
So this answer tells why:
So the socket is setup with the options
SO_REUSEADDR
andSO_REUSEPORT
, which allow multiple processes to bind to the same port and same listening address. ... The goal of this option is to allow an easy form of load balancing: incoming connections to the port will be redirected to one of the processes (apparently at random).
This answer also recommends the detailed answer here. But this detailed answer provides so much information that I need to study further in another session.
Description
On my machine:
nc -v -l 127.0.0.1 8888
can succeed.nc -v -l 127.0.0.1 8888
again can still succeed.But I remember TCP doesn't allow listening to the same address/port at the same time. What's going on?
TODO
undefined reference res_init
?