Windows has 2 types of ports, Static(locked and no other software can use) and Ephemeral(a pool of ports that all software can use, first come first serve).
IM speaks to Directory using an Ephemeral port, and then gives it back and gets another when it needs to communicate.
The problem is if too many software are using these ports they can all be used up.
There are 2 primary solutions:
1. Create a bigger pool of ports
2. Decrease the length of time Windows waits to give back the port TcpTimedWaitDelay -
There are a few other secondary options:
- MaxUserPort - https://technet.microsoft.com/en-us/library/cc938196.aspx
- TCPWindowSize - https://technet.microsoft.com/en-us/library/cc938219.aspx
- MaxFreeTcbs - https://technet.microsoft.com/en-us/library/cc938178.aspx
- MaxHashTableSize - https://technet.microsoft.com/en-us/library/cc938176.aspx
You also need to be careful that none of your software that needs a Specific(Static) Port, that port is in the Ephemeral Port Range.
Here are a few link for Ephmeral Ports for Different Windows OS versions:2008 https://support.microsoft.com/en-us/help/929851/the-default-dynamic-port-range-for-tcp-ip-has-changed-in-windows-vista