Java SocketServer 不受积压值限制

标签 java connection serversocket backlog

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

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/

相关文章:

java - 通过 telnet 连接时出现连接超时

amazon-ec2 - 使用 Amazon EC2 构建聊天服务器

java - 在生产或测试中运行时,Grails 不使用我的数据源?

java - 使用发送重定向到 JSP

node.js - 流式 API - 如何将数据从 Node JS 连接(长时间运行的 HTTP GET 调用)发送到前端(React 应用程序)

mysql - Google Cloud SQL 连接问题 (C#)

Java NIO : Sending more than 16 objects causes error

java - Spring Bean 验证给出 ConstraintDeclarationException

java - 应用程序(JBoss + Hibernate + Infinispan)性能在相同数据上下降

java - 从 Eclipse 访问 Wamp 服务器数据库