【问题标题】:Spring Integration - Is it Possible for TCP Server to disconnect selective clientsSpring Integration - TCP Server是否可以断开选择性客户端
【发布时间】:2017-06-06 06:50:10
【问题描述】:
我正在我的应用程序中实现 Spring Integration (4.x Release) TCP 服务器。多个客户端将连接到我的 TCP 服务器端口。我的应用程序将开始接收多个请求,并且在一种情况下,我的 TCP 服务器应断开其 TCP 客户端之一的连接,以保持与其他客户端的连接处于活动状态。
我能够从服务器连接工厂获取 openConnectionIds,但无法断开所选客户端的连接。
如何断开其中一个 TCP 客户端与 TCP 服务器端口的连接。
【问题讨论】:
标签:
spring-integration
tcpclient
tcp-ip
【解决方案1】:
连接工厂有一个方法可以让你使用它的 ID 关闭连接...
/**
* Close a connection with the specified connection id.
* @param connectionId the connection id.
* @return true if the connection was closed.
*/
public boolean closeConnection(String connectionId) {