How to find number of ephemeral ports in use?

人走茶凉 提交于 2019-12-04 13:11:25

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!