windows java中socket的最大数量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2185834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:52:40  来源:igfitidea点击:

Maximum number of socket in java

javawindowssockets

提问by Shayan

How many is the maximum number of sockets in java under windows? How can I change it?

windows下java中socket的最大数量是多少?我怎样才能改变它?

采纳答案by Steve

This is largely dependent on the max number of file descriptors (handles in Windows) the OS is configured for. Each open file or socket uses one file descriptor. In Solaris, for example, 65536 is the default for max fd's. Chances are, there are additional files using the pool of FD's, therefore limiting the upper limit of sockets unless the OS is tuned to increase the number of FD's

这在很大程度上取决于操作系统为其配置的文件描述符(Windows 中的句柄)的最大数量。每个打开的文件或套接字使用一个文件描述符。例如,在 Solaris 中,最大 fd 的默认值为 65536。很有可能,还有使用 FD 池的其他文件,因此限制了套接字的上限,除非操作系统经过调整以增加 FD 的数量

In Windows NT/2000/XP (Probably Vista & 7) there should be an entry "FILES=" in \Windows\System32\config.nt (Possibly also a registry setting?) that should give you the max number of file handles.

在 Windows NT/2000/XP(可能是 Vista 和 7)中,\Windows\System32\config.nt 中应该有一个条目“FILES=”(可能也是一个注册表设置?),它应该为您提供最大文件句柄数。

Here is a more in depth discussion of the limits in Windows:

以下是对 Windows 中限制的更深入讨论:

http://blogs.technet.com/markrussinovich/archive/2009/09/29/3283844.aspx

http://blogs.technet.com/markrussinovich/archive/2009/09/29/3283844.aspx

回答by jarnbjo

It depends on the configuration of your Windows installation. I don't think that Windows has a process specific limit on the number of TCP connections, but there is a system wide configuration in the registry. You can find an article here, in which the registry keys are described.

这取决于 Windows 安装的配置。我不认为 Windows 对 TCP 连接的数量有特定于进程的限制,但是注册表中有一个系统范围的配置。您可以在此处找到一篇文章,其中描述了注册表项。