NetworkStream streamToServer = tcp.GetStream(); (3) 接收和发送数据 //发送字符串 byte[] buffer = Encoding.Unicode.GetBytes(msg);//msg为发送的字符串 try { lock(streamToServer) { streamToServer.Write(buffer, 0, buffer.Length);// 发往服务器 } //接收字符串 buffer =newbyte[BufferSize]; ...