如何查找正在使用的临时端口数量? [英] How to find number of ephemeral ports in use?

查看:110
本文介绍了如何查找正在使用的临时端口数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了短暂端口耗尽的情况,这随后导致了异常.我想限制连接以避免这种情况.有没有办法检测正在使用的临时端口的数量?

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?

谢谢, 埃里克

推荐答案

要获取打开的连接列表,可以使用netstat命令.与(其他答案)普遍认为的相反,临时端口的数量有限(在Windows 2003上为4000,在更高版本上为16000,在大多数Linux上为16000).还要注意,一旦不使用端口,释放端口要花费4分钟,因此这确实是一个问题.

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.

有关于MSDN的文章: http://msdn.microsoft.com/zh-CN/library/aa560610(v = bts.20).aspx

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

这篇关于如何查找正在使用的临时端口数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆