add some functions to client class, and modify the connection thread, which is the interface thread to handle incoming connection