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?
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.
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?
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 !
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
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"
}
]