If my server has multiple IP addresses assigned to it, and I would like to listen to some (or all) of them, how do I go about doing that?
Do I need to create a new socke
If you want to listen on all IPv4 and IPv6 addresses, use this code:
var listener = new TcpListener(IPAddress.IPv6Any, port);
listener.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false);
IPv6Any
tells Windows to listen on the IPv6 stack. Setting the socket option to false tells Windows to not limit itself to the IPv6 stack, but rather to also listen on the IPv4 stack. The default is to only listen on the stack explicitly specified.