change recv timeout to recv end_symbol, and identify the scan mode