简体   繁体   中英

How to force TcpNetClientConnectionFactory to open a connection without sending a message?

I have a task to create a Spring-integration TCP client which should connect to a server and receive messages from it:

  • The server is responsible for sending "heartbeat" and data messages and doesn't expect any incoming messages from the client, except acknowledgements.
  • The client must open and maintain (reopen) a connection to the server.

As I understand, TcpNetClientConnectionFactory opens a connection only upon sending a message. Is there any way to open a connection without sending any data (something like SocketFactory.createSocket(host, port) does) and maintain it?

Please, investigate a TcpReceivingChannelAdapter and let us know why it doesn't work for you:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM