Beispiel #1
0
        public void TestSend()
        {
            string command = "Hoi";

            byte[] data = Encoding.ASCII.GetBytes(command);
            c.Send(command);
        }
Beispiel #2
0
 /// <summary>
 /// Sends the command at the designated Control EndPoint.
 /// Receives a response from the device at the same EndPoint when possible.
 /// </summary>
 /// <param name="command">The command to send.</param>
 public void SendCommand(byte[] command)
 {
     try
     {
         ControlClient.Send(command, command.Length);
         IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 0);            // TODO: Maybe change to read to defined source
         byte[]     receivedBytes    = ControlClient.Receive(ref RemoteIpEndPoint); // Maybe add timeout here (await/async)
         IsDeviceResponseValid(receivedBytes);
     }
     catch (Exception)
     {
         throw;
     }
 }