using Readline to read socket; handle timeout