readCalls = false; myThread = new Thread(new ThreadStart(receive)); myThread.IsBackground = true;РmyThread.Start();Р}Рprivate void receive()Р{РtcpClient.Connect(IPAddress.Parse("192.168.1.106"), 8080); while (true)Р{Рns = tcpClient.GetStream();Рstring ReadMessage = ""; byte[] bytes = new byte[1024]; ns.Read(bytes, 0, bytes.Length);РReadMessage = Encoding.Unicode.GetString(bytes);РrichTextBox1.Text = ReadMessage;Рns.Flush();Р}Р} private void btnSend_Click(object sender, EventArgs e)Р{РtryР{Рns = tcpClient.GetStream();Рbyte[] bytes = new byte[1024];Рbytes = Encoding.Unicode.GetBytes(richTextBox1.Text + "\r\n" + "客户端说: " + richTextBox2.Text);Рns.Write(bytes, 0, bytes.Length);РrichTextBox1.Text = richTextBox1.Text + "\r\n" + "客户端说: " + richTextBox2.Text;РrichTextBox2.Clear();Р}Рcatch { }Р}Р}Р}