1

With REUSEADDR/REUSEPORT one can create 2 identical sockets bound to the same address and port in a machine. Is it possible to receive the same data on the 2 sockets?

My case is that a defined udp port number will produce data on a network. In my machine I have 2 implementations of the protocol in 2 threads that I wish would be able to consume that data directly from the socket api.

Thanks

Regards Thomas

TomCam
  • 41
  • 3
  • The `REUSEADDR` option doesn't do what you think it does. It allows you to bind to an address/port that is bound by another socket that is in the `TIME_WAIT` TCP state. You can not have two active sockets bound to the same address/port pair. So it is pretty useless for UDP sockets. – Some programmer dude Oct 14 '16 at 08:08
  • As for the `REUSEPORT` option, it basically allows a single process to have multiple threads bound to the same port as a cheap way of load-balancing connections. It's not possible to use it for unrelated processes. – Some programmer dude Oct 14 '16 at 08:10
  • 1
    Thanks. Is it possible to duplicate data onto 2 sockets in some other smart way? – TomCam Oct 14 '16 at 08:58

0 Answers0