Added threads to exchange data between cli and svr.