# ModBus TCP Client Node open many connections!

**URL:** <https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146>\
**Category:** General\
**Created:** [20 October 2018 20:06 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146 "2018-10-20T20:06:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![roberto.zeni](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/roberto.zeni/32/3226_2.png) [@roberto.zeni](https://discourse.nodered.org/u/roberto.zeni)\
**Post date:** [20 October 2018 20:06 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/1 "2018-10-20T20:06:45Z")

</div>

Hi all,

I have a PLC that acts as ModBus TCP Server and can manage only 1 ModBus TCP Client.

In Node Red I use the "node-red-contrib-modbustcp" library to read and write some tags (Holding register, Coil, etc) and so I use many different modbustcp-read nodes that use the same Server.

It seems that, for every modbustcp-read node, Node Red open a different connection with the Server.

In effect, PLC side, I see that first connection from Node Red is accepted and the others are refused (Node Red side only 1 modbustcp-read node is "Connected").

In Node Red I have defined only one Server.

Is it possible to force system in using only one connection?

Thanks

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 October 2018 06:37 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/2 "2018-10-21T06:37:30Z")

</div>

Not sure if the author of the node hangs out here. Maybe best to raise an issue direct on that nodes repository on github.

---

<div class="post-metadata">

**Author:** ![ajaymn](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajaymn](https://discourse.nodered.org/u/ajaymn)\
**Post date:** [15 July 2019 15:44 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/3 "2019-07-15T15:44:51Z")

</div>

Hello Roberto, Were you able to solve this issue ? I am facing the same issue in my implementation  
Ajay

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [15 July 2019 16:08 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/4 "2019-07-15T16:08:43Z")

</div>

If you look at the issues on the github page for the node you should be bale to see if @roberto.zeni opened an issue.

If he did you can add to it, hopefully making it easier for the author to resolve the issue.  
If he didn't then you can open the issue direct with the nodes author and hopefully get it resolved.

---

<div class="post-metadata">

**Author:** ![thatcadguy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thatcadguy/32/5273_2.png) [@thatcadguy](https://discourse.nodered.org/u/thatcadguy)\
**Post date:** [15 July 2019 16:34 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/5 "2019-07-15T16:34:50Z")

</div>

There are also other Modbus TCP client nodes you can try

---

<div class="post-metadata">

**Author:** ![NickB](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@NickB](https://discourse.nodered.org/u/NickB)\
**Post date:** [16 July 2019 09:54 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/6 "2019-07-16T09:54:13Z")

</div>

To have a temporarely solution: Can't you place all your register after each other in the PLC and then do only 1 read? The different read nodes are always different telegrams. On my suggested way you can combine all these telegrams in 1. Then you do the split in node-red.  
What PLC do you have? How fast does he closes his sockets?

Br

---

<div class="post-metadata">

**Author:** ![ajaymn](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajaymn](https://discourse.nodered.org/u/ajaymn)\
**Post date:** [23 August 2019 03:19 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/7 "2019-08-23T03:19:44Z")

</div>

Yes I finally ended up doing that

---

<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:** [23 August 2019 07:04 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/8 "2019-08-23T07:04:37Z")

</div>

Did you raise an issue on the repo? The author may not realise this is happening. Would be good for the community if this was fixed.

---

<div class="post-metadata">

**Author:** ![ajaymn](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@ajaymn](https://discourse.nodered.org/u/ajaymn)\
**Post date:** [24 August 2019 07:21 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/9 "2019-08-24T07:21:35Z")

</div>

Hello @Steve-Mcl

I havent raised an issue on the repo. I used the modbus flex and that worked so didn't come back to this node. Will raise this on the repo. Thanks for the note !

AJ

---

<div class="post-metadata">

**Author:** ![NABIN](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nabin/32/14438_2.png) [@NABIN](https://discourse.nodered.org/u/NABIN)\
**Post date:** [26 April 2021 19:27 UTC](https://discourse.nodered.org/t/modbus-tcp-client-node-open-many-connections/4146/10 "2021-04-26T19:27:41Z")

</div>

I have also come across a similar issue recently. ie to read multiple registers using a single Modbus TCP node. You can configure the Node by injecting the JSON string in msg.payload

here is an example to read two different registers using a single node

```auto
msg.payload = [{
    "name": "Name2", // Should be a unique name
    "topic": "topic2", // Override default topic 
    "dataType": "FC3", // can be format 3, "FC3", or "Coil"
    "address": 0, // starting address
    "quantity": 4, // # of units to read
    "interval": 3000, // polling interval in milliseconds
    "ieeeType": "off", // valid values are "off", "single" or "double"
    "ieeeBE": true // Big Endian format, true/false. false = little endian
},{
    "name": "Name3", // Should be a unique name
    "topic": "topic3", // Override default topic 
    "dataType": "FC3", // can be format 3, "FC3", or "Coil"
    "address": 416, // starting address
    "quantity": 10, // # of units to read
    "interval": 3000, // polling interval in milliseconds
    "ieeeType": "off", // valid values are "off", "single" or "double"
}

]

```

you can find the same by visiting the node help page  
[node-red-contrib-modbustcp](https://flows.nodered.org/node/node-red-contrib-modbustcp)
