I am using codesys Modbus TCP client (4.4.0.0) to communicate with a python modbus server (package pyModbusTCP).
I first start my python server on the distant machine.
After a fresh codesys compilation, a plc connection/transfer and a PLC run, the modbus connection is OK. Every time in this context the connection is created correctly.
When I shut down the server, the modbus connection falls, that is normal.
When I restart the python server, impossible to recreate the modbus connexion. With the client autoreconnection, I see on my server that the client tries to connect but unsuccesfully. I have the following message :
DEBUG:pyModbusTCP.server:accept new connection from ClientInfo(address='192.168.1.20', port=33476)
DEBUG:pyModbusTCP.server:Exception during request handling: NetworkError('recv return null')
I tried to stop the codesys client and to restart it with these commands :
The answer of this function when executed is "status_client = NOT_SUPPORTED". Is it normal ?
It seems that is a socket problem, but I do not understand if it is on the client or server side.
I tried a modbus simulator called "ananas.exe" and the result is the same. Impossible to get a modbus client reconnection.
What is different at the first client connection and at a reconnection attempt ?
Thanks for your help
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The client modbus cycle time was linked to a task at 500ms. Whereas the channel modbus was at 200ms. Certainly problem of packages synchronisation.
I let the client modbus cycle time to be handled by itself (See attachement) --> "Use the bus cyle time parameters" (traduce from french)
See attachement
Hello,
I am using codesys Modbus TCP client (4.4.0.0) to communicate with a python modbus server (package pyModbusTCP).
I first start my python server on the distant machine.
After a fresh codesys compilation, a plc connection/transfer and a PLC run, the modbus connection is OK. Every time in this context the connection is created correctly.
When I shut down the server, the modbus connection falls, that is normal.
When I restart the python server, impossible to recreate the modbus connexion. With the client autoreconnection, I see on my server that the client tries to connect but unsuccesfully. I have the following message :
I tried to stop the codesys client and to restart it with these commands :
I tried to confirm the error manually to force reconnection with:
I tried also this command to STOP/RESET/START client and server (codesys side) but nothing happens :
The answer of this function when executed is "status_client = NOT_SUPPORTED". Is it normal ?
It seems that is a socket problem, but I do not understand if it is on the client or server side.
I tried a modbus simulator called "ananas.exe" and the result is the same. Impossible to get a modbus client reconnection.
What is different at the first client connection and at a reconnection attempt ?
Thanks for your help
Problem solved
The client modbus cycle time was linked to a task at 500ms. Whereas the channel modbus was at 200ms. Certainly problem of packages synchronisation.
I let the client modbus cycle time to be handled by itself (See attachement) --> "Use the bus cyle time parameters" (traduce from french)
See attachement