Hi,
I'd need some advice on how to setup a stable, fail safe TCP network connection. The client is a PLC and the server a Lazarus/freepascal program using the network library Synapse. By now the connection works fine, but it can get stuck when the network cable is unplugged while running. My first attempt was to do an automatic reconnect, when a timeout/error state is detected. As for the new connection this would work, but then I don't know whether or which data was lost in the meantime.
Storing and tracing the sent data seems redundant, so I thought it is probably better to rely on the mechanisms of TCP, that should try to resend dropped/corrupted IP packages. And I found out that this works when the windows firewall is disabled. Unplugging and replugging the network cable for like half a second even repeatedly will continue delivering all packets in both directions. I could make proper timeouts to cut of the connection, in case the data is not transfered in time. But once the firewall is enabled with rules to allow the traffic, a short unplugging of the cable will stop all traffic, the server doesn't receive any more data. In wireshark I can see the first incoming packet and some retransmission trials, while the programm doesn't receive it. The firewall logs don't show any blocked TCP packets. There are some UDP and ICMP packets that are blocked, but it doesn't seem related.
The network traffic is realtime data, so if the connection is down for several seconds I could give up and go into error state. But very short network drops should not lead to a reset.
How is it normally done?
What could be the reason, that the connection gets stuck only when the firewall is enabled?
The unplugging of the cable is just a simulation for a real live network problem, perhaps this is a wrong approach?
Thanks and Regards