- Posts: 3
- Thank you received: 0
Duplicate active TCP sockets generated by a single `Modbus_TCP_Slave`
5 days ago #420
by Eduardo
Environment Specs:
) after a cold boot, the main PLC process (
) opens two simultaneous active TCP sockets to the Modbus gateway IP
. Both sockets actively transmit identical Modbus TCP request streams in parallel, causing frame collisions and delays on the underlying RS-485 serial bus.Diagnostic Evidence:1. Socket Inspection ( ss -tnp )
Both
and
continuously fluctuate on both file descriptors (fd=4 and fd=6), proving that both sockets are actively exchanging traffic with the gateway (neither socket is idle or hanging).2. Payload Analysis ( tcpdump )Decoding the Modbus TCP application layer reveals a 1:1 mirror traffic pattern between local ports
and
:
- ProviewR Version: 6.1.5
- OS: Linux (Debian 12 / Linux Mint)
- Node / Bus: Development Node under Bus 999 (
)Code:plc_wicotas_0999_plc
- Modbus Gateway: Exemys EGW1 (Modbus TCP to RS-485 converter, IP
)Code:10.59.1.50:502
- Slave Devices: Micro Motion RFT9739 (Unit ID 1), Micro Motion 1700 MVD (Unit ID 3)
Code:
rt_ini &
Code:
plc_wicotas_0999_plc
Code:
10.59.1.50:502
Code:
ESTAB 0 0 10.59.1.2:60178 10.59.1.50:502 users:(("plc_wicotas_0999_plc",pid=25050,fd=4))
ESTAB 0 24 10.59.1.2:60180 10.59.1.50:502 users:(("plc_wicotas_0999_plc",pid=25050,fd=6))
Code:
Send-Q
Code:
Recv-Q
Code:
60178
Code:
60180
- Port 60178: Transmits
(Read Holding Registers for PDU 246, 258, 244, 1) andCode:FC03(Write Single Coil 3) to Unit ID 1 and Unit ID 3.Code:FC05
- Port 60180: Transmits identical
andCode:FC03request bursts to Unit ID 1 and Unit ID 3 at the exact same intervals.Code:FC05
- There is strictly one Modbus_Master and one Modbus_TCP_Slave object under
.Code:wicoTAS ➔ IO
- A single
(Code:PlcThread) is defined and assigned.Code:Plc1
- Attribute
is set uniformly across allCode:Process = 1 (PLC)objects.Code:Modbus_Module
- A clean build (
+Code:Clean Volume) was performed, but two sockets continue to open automatically on runtime startup.Code:Build Node
- Why does the PLC runtime engine instantiate two independent TCP sockets (
andCode:fd=4) for a singleCode:fd=6object?Code:Modbus_TCP_Slave
- Does ProviewR separate cyclic transactions (
) from triggered transactions (Code:Continuous = YES) into dedicated sockets, or isCode:Continuous = NObeing called twice within the multithreaded framework?Code:io_init()
- What is the recommended configuration to force ProviewR to multiplex all Modbus TCP requests over a single TCP socket descriptor?
Please Log in or Create an account to join the conversation.
4 days 23 hours ago #421
by Eduardo
Replied by Eduardo on topic Duplicate active TCP sockets generated by a single `Modbus_TCP_Slave`
Apologies for the formatting issue in the main post!** The forum editor automatically parsed the inline code tags into `Code:` blocks and split some lines, and I am unable to edit the original thread.
To summarize the core environment and issue cleanly:
**PLC Process:** `plc_wicotas_0999_plc` (Bus 999)
**Target Gateway:** Exemys EGW1 (`10.59.1.50:502`)
**Slaves:** Micro Motion RFT9739 (ID 1) & Model 1700 (ID 3)
**Issue:** Executing `rt_ini &` automatically opens two active TCP sockets (`fd=4` and `fd=6`) from the exact same process (`pid=25050`) to `10.59.1.50:502`, sending 1:1 identical Modbus TCP request bursts.
Thank you for your understanding and any guidance on how to resolve this duplicate socket behavior!
To summarize the core environment and issue cleanly:
**PLC Process:** `plc_wicotas_0999_plc` (Bus 999)
**Target Gateway:** Exemys EGW1 (`10.59.1.50:502`)
**Slaves:** Micro Motion RFT9739 (ID 1) & Model 1700 (ID 3)
**Issue:** Executing `rt_ini &` automatically opens two active TCP sockets (`fd=4` and `fd=6`) from the exact same process (`pid=25050`) to `10.59.1.50:502`, sending 1:1 identical Modbus TCP request bursts.
Thank you for your understanding and any guidance on how to resolve this duplicate socket behavior!
Please Log in or Create an account to join the conversation.
4 days 16 hours ago #422
by claes
Replied by claes on topic Duplicate active TCP sockets generated by a single `Modbus_TCP_Slave`
Hi Eduardo,
I suspect you have configured two slave objects with the same IP address, and as every slave object will open a socket (which is normal for Modbus TCP slaves) there will be two sockets.
From ProviewR viewpoint there is only one TCP slave here, the modbus gateway, so you should only configure one slave object. Then use the UnitId in the module object to specify the target for each transaction.
All transactions, cyclic or triggered, are sent through the same socket.
/Claes
I suspect you have configured two slave objects with the same IP address, and as every slave object will open a socket (which is normal for Modbus TCP slaves) there will be two sockets.
From ProviewR viewpoint there is only one TCP slave here, the modbus gateway, so you should only configure one slave object. Then use the UnitId in the module object to specify the target for each transaction.
All transactions, cyclic or triggered, are sent through the same socket.
/Claes
Please Log in or Create an account to join the conversation.
4 days 14 hours ago #423
by Eduardo
Replied by Eduardo on topic Duplicate active TCP sockets generated by a single `Modbus_TCP_Slave`
Hi Claes,
Thanks a lot for the quick reply and the clarification!
I double-checked my I/O tree configuration in the Workbench to be 100% sure, and I can confirm that I only have a single Modbus_TCP_Slave object defined under `wicoTAS ➔ IO` configured with the gateway IP (`10.59.1.50`).
All `Modbus_Module` objects (for both Unit ID 1 and Unit ID 3) hang directly as children of this single slave object.
Despite having just one `Modbus_TCP_Slave` in the tree, as soon as `rt_ini` starts up, `ss -tnp` shows two active TCP sockets (fd=4 and fd=6) under the same PLC process PID (`plc_wicotas_0999_plc`), both sending 1:1 identical Modbus TCP frame bursts.
Could there be any hidden setting, cached runtime configuration, or thread initialization behavior that might cause the runtime to instantiate a second socket for the same slave object?
Thanks again for your support!
Best regards, Eduardo
Thanks a lot for the quick reply and the clarification!
I double-checked my I/O tree configuration in the Workbench to be 100% sure, and I can confirm that I only have a single Modbus_TCP_Slave object defined under `wicoTAS ➔ IO` configured with the gateway IP (`10.59.1.50`).
All `Modbus_Module` objects (for both Unit ID 1 and Unit ID 3) hang directly as children of this single slave object.
Despite having just one `Modbus_TCP_Slave` in the tree, as soon as `rt_ini` starts up, `ss -tnp` shows two active TCP sockets (fd=4 and fd=6) under the same PLC process PID (`plc_wicotas_0999_plc`), both sending 1:1 identical Modbus TCP frame bursts.
Could there be any hidden setting, cached runtime configuration, or thread initialization behavior that might cause the runtime to instantiate a second socket for the same slave object?
Thanks again for your support!
Best regards, Eduardo
Please Log in or Create an account to join the conversation.
Time to create page: 0.745 seconds