Skip to main content

Socket options with UDP

So while playing around with mDNS implementations on Linux, and trying to get a handle on how some of the socket options  - SO_REUSEADDR , IPV6_ADD_MEMBERSHIP , IPV6_MULTICAST_LOOP worked with UDP over IPV6, I created a simple chart for my reference. These options are invoked using the setsockopt() call.

SO_REUSEADDR is usually used in case of TCP - when you want to reopen a socket on the port which was just closed and is currently in TIME_WAIT state. Read more here.

IPV6_ADD_MEMBERSHIP & IPV6_MULTICAST_LOOP are used when you want to create multicast groups - for example in case of mDNS you want to receive all packets destined to FF02::FB. The Windows implementation (described here) of these two option is the same as Linux.


PDF of above chart is here

Comments