Exemple #1
0
 private void Button3_Click(object sender, EventArgs e)
 {
     if (server._clientsList.Count > 0)
     {
         if (ClientslistBox.SelectedIndex != -1)
         {
             server.HandleSendData(server._clientsList[ClientslistBox.SelectedIndex], Encoding.ASCII.GetBytes(this.SendtextBox.Text));
         }
         else
         {
             MessageBox.Show("请选择客户端!");
         }
     }
     else
     {
         MessageBox.Show("无客户端连接!");
     }
 }
 /// <summary>
 /// 发送数据
 /// </summary>
 /// <param name="socket"></param>
 /// <param name="data"></param>
 public void SendAsync(Socket socket, byte[] data)
 {
     server.HandleSendData(socket, data);
 }