# Node-red-contrib-modbus. Cannot recover TCP connection after server rebooting

**URL:** <https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123>\
**Category:** General\
**Created:** [14 June 2021 07:30 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123 "2021-06-14T07:30:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://discourse.nodered.org/u/John1)\
**Post date:** [14 June 2021 07:30 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/1 "2021-06-14T07:30:30Z")

</div>

Hello community.

I have a question about possibility to automatically recover TCP connection after modbus server rebooting.

There is next situation: Where I deploy the flow, all work good (TCP connection is set, client can read data from server via modbus protocol). But when I reboot the server, TCP connection falls and did't recover when TCP server is in network. To solve this problem I should deploy flow again. After this all work good until next server rebooting.

It seems to me it is internal bug of node-red-contrib-modbus lib. When modbus client node cannot connect to modbus server, it try to do again in specified time interval (according to checkbox in node parameters). But it try to do that only one time (not periodically). If second connection attempt was unsuccessful, node is set to "error mode" and does not work until next flow deployement.

I read similar topic:

> [@Initiate new connections](https://discourse.nodered.org/t/initiate-new-connections/6774):
>
> I have tried searching but haven't found anything along the lines of my question. Is there a node that can be used to trigger a fresh initiation of external connections? Making a small physical move of even a comment node and then clicking deploy acheives exactly what I need, but how to automate is my question. I use some ModbusTCP connections. If the network drops out the nodes don't reconnect. Triggering a fresh Deploy solves the problem but requires user intervention. I can test and als…

but I did't find solution there. Any ideas about it ?

One more thing. There is something similar when work with modbus RTU connection. When I disconnect slave deivce whole Node-RED goes down and I should start it again (Node-RED server runs on Windows10 64bit - probalbly it can be a reason of these problems??)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 June 2021 07:36 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/2 "2021-06-14T07:36:50Z")

</div>

> [@John1](#):
>
> Where I deploy the flow, all work good (TCP connection is set, client can read data from server via modbus protocol). But when I reboot the server, TCP connection falls and did't recover when TCP server is in network. To solve this problem I should deploy flow again. After this all work good until next server rebooting.

I think this is a know issue [Modebus-Flex-Getter Node stops working every few hours - "initialize" Reopened · Issue #246 · BiancoRoyal/node-red-contrib-modbus · GitHub](https://github.com/BiancoRoyal/node-red-contrib-modbus/issues/246)

---

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://discourse.nodered.org/u/John1)\
**Post date:** [14 June 2021 07:47 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/3 "2021-06-14T07:47:47Z")

</div>

I cannot find solution of this issue there. Only description. Will it be fixed in next version of library ? Or there is some work-around I should use to solve this problem ?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 June 2021 07:49 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/4 "2021-06-14T07:49:52Z")

</div>

The issue is still "open" (so not fixed).

Whether it gets fixed is down to the author. If you can add info to the issue it may help the author fix issue faster.

---

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://discourse.nodered.org/u/John1)\
**Post date:** [14 June 2021 07:54 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/5 "2021-06-14T07:54:34Z")

</div>

Thank you for your help. I am new in Node-RED forum. So, there are a lot of thing here I don't know.

---

<div class="post-metadata">

**Author:** ![farcry](https://avatars.discourse-cdn.com/v4/letter/f/9de053/32.png) [@farcry](https://discourse.nodered.org/u/farcry)\
**Post date:** [3 January 2022 19:00 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/6 "2022-01-03T19:00:27Z")

</div>

Hello.  
I have the same problem.  
I use Modbus Flex Server. (TCP/IP)  
When I deploy / restart NodeRed the client connects to server.  
If I reboot home router, the connection fails.  
For client to connect, I have to deploy / restart NodeRed flows.  
Did you find any sollution?  
Thanks.

---

<div class="post-metadata">

**Author:** ![John1](https://avatars.discourse-cdn.com/v4/letter/j/e9bcb4/32.png) [@John1](https://discourse.nodered.org/u/John1)\
**Post date:** [4 January 2022 11:55 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/7 "2022-01-04T11:55:15Z")

</div>

Yes. The problem was in Node.js version. You should use recommended version of this software instead of latest. More information you can find here:

[https://nodered.org/docs/faq/node-versions](https://nodered.org/docs/faq/node-versions)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 January 2022 11:55 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-cannot-recover-tcp-connection-after-server-rebooting/47123/8 "2022-01-18T11:55:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
