I have question about Modbus Server Connection time out

I want to maintain connected state with the UR modbus server

Currently, I am using the modbus communication as follows.

  1. Socket connection

  2. Send protocol (send or receive)

  3. Confirm the return value

  4. Close the socket

However, I wants to send and receive data continuously
with the first connection without the socket close.
(To save connection and disconnection time)

In the case of the Socket Test, ananas(the period over the 2 sec) and my program,
if I make a socket connection and do not send data,
the server disconnects after 2 seconds.
I confirms that it is in close_wait state.

In this regard, I want to know how to maintain connected state.

EX)

  1. How to modify TimeOut of UR Modbus server.

  2. How to use the keepalive function on the client side

  3. Other good ways …

thank you for reading my issue

I have the same problem. No one can help me ?