What IP Address(es) do we listen on?

When listening on any socket-based protocol (http, net.tcp, UDP, SMTP, etc), there are ultimately two items that contribute to where we listen: IP Address and Port.

Your port# is usually specified in the URI of your endpoint (see RFC 2396, section 3.2.2). If a port# is not specified then each URI scheme has the option of supporting a default port# (HTTP uses 80, HTTPS uses 443, net.tcp uses 808, etc.). You can also configure a WCF endpoint to listen on
any available port# for client-side or Discovery/registry purposes.

For WCF transports, your IP Address is specified in the same manner, though this may not be obvious on the surface. If you specify an IP Address in the hostname of your URI, then we will listen on that exact IP Address. For example, net.tcp:// will only receive traffic received on the IPv4 localhost interface.

If you do not specify an IP Address in your endpoint URI, then the transport will provide a set of default IP Addresses for listening. For net.tcp, we will listen on IP_ANY (both V4 and V6 where available). For http, we will use the http.sys IP Listen List, which also defaults to INADDR_ANY and INADDR6_ANY.

For routing traffic, wildcard semantics are in effect, which means that net.tcp://localhost/a/b and net.tcp:// will match the same set of incoming Messages. The difference is that the first URI is exposed to all interfaces/IP Addresses while the second URI is limited solely to

Leave a Reply

Your email address will not be published. Required fields are marked *