首页 > 解决方案 > 如何强制 TcpNetClientConnectionFactory 打开连接而不发送消息?

问题描述

我的任务是创建一个 Spring 集成 TCP 客户端,该客户端应该连接到服务器并从中接收消息:

据我了解,TcpNetClientConnectionFactory仅在发送消息时才打开连接。有没有办法在不发送任何数据(类似的东西SocketFactory.createSocket(host, port))的情况下打开连接并维护它?

标签: spring-integrationspring-integration-ip

解决方案


请调查 aTcpReceivingChannelAdapter并告诉我们为什么它对您不起作用:

https://docs.spring.io/spring-integration/docs/current/reference/html/ip.html#tcp-adapters


推荐阅读