On behalf of velma911: Fixing infinite read from socket. Fixes issue 7814