I have three applications that talk to each other using sockets. They can all live on their own machines but they can also share a machine. Right now I’m having two of them on the same and the third on its own machine. I’m trying to make my communication bullet proof so I unplug cables and kill the applications to make sure everything works as intended.
Here’s a quick sketch of the thing:
Now, when I unplug the network cable to PC2 (the red connection ‘Con B’), the internal connection stops talking (the blue connection ‘Con A’). I send stuff from ‘App 1’ on the socket that never gets to ‘App 2’.
I have made a mechanism that discovers this and disconnects and then reconnects and after that I can unplug the cable all I want and ‘Con A’ just keeps working. It’s only that first time.
I have confirmed having communication through ‘Con A’ before disconnecting ‘Con B’.
I connect and reconnect exactly the same way, it’s the same code, so there’s no difference.
What’s happening?
Additional information trigged by answers: PC 1 and PC 2 share addresses down to the last byte.
I have an internal keep alive mechanism, I send a message and expect a response every 10 seconds.
When I kill App 3, this does not happen, only when unplugging the cable.

What address are you using for ‘Con A’? If you are using an address that is bound to the external network adapter, even though you’re talking to the same machine, then what you describe could happen.
What you can do is use the address
localhost(127.0.0.1) for ‘Con A’, which should be completely independent of what happens on the external network.