gpt4 book ai didi

Java SocketServer 不受积压值限制

转载 作者:行者123 更新时间:2023-11-30 07:54:21 27 4
gpt4 key购买 nike

我在应用程序中使用客户端-服务器机制来传输内部数据。服务器部件之一应设计为一次服务一个请求,没有线程,没有积压。我发现奇怪的功能然后使用:

serverport = new ServerSocket(port, 1, InetAddress.getLoopbackAddress());

即使一个连接已积压,此连接仍会继续接收传入连接吗?有什么建议吗?我该如何解决这个问题?

最佳答案

正如 Javadoc 中所述:

The backlog argument is the requested maximum number of pending connections on the socket. Its exact semantics are implementation specific. In particular, an implementation may impose a maximum length or may choose to ignore the parameter altogther. The value provided should be greater than 0. If it is less than or equal to 0, then an implementation specific default will be used.

关于Java SocketServer 不受积压值限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32885119/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com