update tcpserver and code it as a server mode based on tcp protocol