Added code to detect early endings of network messages if the socket gets broken unexpectedly