How To Fix Error "Only one usage of each socket address (protocol/network address/port) is normally permitted"

If you see the error, "Only one usage of each socket address (protocol/network address/port) is normally permitted" in the logs when a connection is being made, it means that you are exhausting all the available network ports on the machine. By default the OS only has around 4000 ports available that are not reserved by the system. What happens is that when any network connection is closed it goes into a TIME_WAIT state for 240 seconds and cannot be reused until this wait state is over.

As an example, if there are 16 connections per second for 4 minutes (16*4*60=3840), you will exhaust all the ports shortly there after. Now if you have HAS and the MTA on the same machine, this will get exhausted a lot sooner because in addition to them communicating with each other, which uses 2 ports (one for the MTA and one for HAS), the MTA uses up a lot of ports sending the mail.

You can fix this by modifying the below values.

  1. One of the ways is to increase the dynamic port range. The max by default is 5000. You can set this up to 65534. HKLMSystemCurrentControlSetServicesTcpipParametersMaxUserPort is the
    key to use.

  2. The second thing you can do is, once the connection does get into an TIME_WAIT state, you can reduce the time it is in that state. Default is 4 minutes, but you can set this to 30 seconds.
    HKLMSystemCurrentControlSetServicesTcpipParametersTCPTimedWaitDelay is the key to use.

After these changes are made the system must be restarted.

For more information, please refer to this Microsoft article.