예제 #1
0
        public void SendCommand(string command)
        {
            udp = new UdpClient();
            byte[] message = Encoding.Unicode.GetBytes(command);
            int    sended  = 0;

            try
            {
                while (sended < message.Length)
                {
                    foreach (DataGridViewRow dgr in dataGridView1.SelectedRows)     //Всем выделенным хостам
                    {
                        sended = udp.Send(message, message.Length, ResponceParse.GetIp_fromName(dgr.Cells[0].Value.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                udp = null;
            }
        }