bugfix: If server is too slow or not responding, it appears connection is not reset.
We introduce a new variable 'maxWriteTimeout' : if no write is done during this period, connection to the server is reset.