As far as I know, there is no closing of the logical connection in this protocol (no disconnectPLC, as in MPI). To exit cleanly from a program or before doing a reconnect on the TCP level, just close the socket file descriptor.
To test whether this is correct, just try the following:
1. Make a test programm that reads from the CP in loop.
2. Start multiple instances of it until the CP cannot accetp a new connection, because it is out of resources.
3. Now terminate an instance.
4. Try to start another instance.
I cannot do this for you, as I have no CP to test with.
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I cannot see any 'Disconnect ' function in order to close the ISO on TCP communication socket.
How can I correctly close the connection with the CP?
As far as I know, there is no closing of the logical connection in this protocol (no disconnectPLC, as in MPI). To exit cleanly from a program or before doing a reconnect on the TCP level, just close the socket file descriptor.
To test whether this is correct, just try the following:
1. Make a test programm that reads from the CP in loop.
2. Start multiple instances of it until the CP cannot accetp a new connection, because it is out of resources.
3. Now terminate an instance.
4. Try to start another instance.
I cannot do this for you, as I have no CP to test with.
Thomas