I have a need to send messages between 2 PLCs and I cant use network variables (because of size limit) so I tried writing this simple test program.
This seems to work fine. I can send messages back and forth when a first "Start server" and then "Connect client". See the attached image.
However, if I disconnect the client by setting ClientConnect to false and try to re-connect then the TCP_Client just gives me TIMEOUT error.
When I stop and start the server again, then Im able to reconnect.
How is this supposed to work? Why reconnecting wont work. There is not other way of disconnecting the client than setting xEnable of the TCP_Client to false.
This is just a testing program and I will try it on 2 seperate devices once this works.
Just in case that someone else is now to this also. It seems that the xDone of the TCP_Connection FB goes true once client disconnects and then you need to reset the FB by setting the xEnable to false.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a need to send messages between 2 PLCs and I cant use network variables (because of size limit) so I tried writing this simple test program.
This seems to work fine. I can send messages back and forth when a first "Start server" and then "Connect client". See the attached image.
However, if I disconnect the client by setting ClientConnect to false and try to re-connect then the TCP_Client just gives me TIMEOUT error.
When I stop and start the server again, then Im able to reconnect.
How is this supposed to work? Why reconnecting wont work. There is not other way of disconnecting the client than setting xEnable of the TCP_Client to false.
This is just a testing program and I will try it on 2 seperate devices once this works.
Last edit: jari-koivuluoma 2024-10-03
Solved.
Just in case that someone else is now to this also. It seems that the xDone of the TCP_Connection FB goes true once client disconnects and then you need to reset the FB by setting the xEnable to false.