new Thread(ListenClientConnect);Р myThread.Start();Р buttonStart.Enabled = false;Р buttonStop.Enabled = true;Р }Р /// <summary>接收客户端连接</summary>Р private void ListenClientConnect()Р { TcpClient newClient = null;Р while (true)Р { tryР {Р newClient = myListener.AcceptTcpClient();Р }Р catchР {Р break;Р }Р User user = new User(newClient);Р Thread threadReceive = new Thread(ReceiveData);Р threadReceive.Start(user);Р userList.Add(user); //每接受一个客户端连接,就创建一个对应的线程循环接收该客户端发来的信息Р AddItemToListBox(string.Format("[{0}]进入", newClient.Client.RemoteEndPoint));Р AddItemToListBox(string.Format("当前连接用户数:{0}", userList.Count));//用于显示当前连接的用户数量Р }Р }Р/// <summary>Р /// 处理接收的客户端数据Р /// </summary>Р /// <param name="userState">客户端信息</param>Р private void ReceiveData(object userState)Р { User user = (User)userState;