Question

I have a situation where I am running into ephemeral port exhaustion, which is then causing exceptions. I would like to throttle the connections to avoid this. Is there a way to detect the number of ephemeral ports in use?

Thanks, Erick

No correct solution

OTHER TIPS

To get list of open connection you may use netstat command. Contrary to popular believe (of other answers) number of Ephemeral ports is limited (4000 on Windows 2003, some 16000 on later versions, 16000 on most Linuxes). Note also that it take 4 minutes to release port once it become unused therefore it really can be an issue.

There is article on MSDN dealing with it: http://msdn.microsoft.com/en-us/library/aa560610(v=bts.20).aspx

The only way you can run out of ephemeral TCP ports is if you are a client and you have opened nearly 64k outbound connections, and not closed them within the last two minutes.

This sometimes happens in testing scenarios, but it doesn't represent a real-world case so it is of no real interest.

The symptom of this is bind errors when connecting. If you aren't getting bind errors you don't have this problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top