add readline, handshake and timeout control