Add timeout to receive socket message. Read max 1k buffer from socket and return; otherwise the last read will block until reach timeout.