Ejemplo n.º 1
0
 public static void Restart(AmsNetId target)
 {
     using (AdsClient client = new AdsClient())
     {
         client.Connect(new AmsAddress(target, AmsPort.SystemService));
         client.WriteControl(new StateInfo(AdsState.Reset, 0));
     }
 }
Ejemplo n.º 2
0
        public static void Reboot(AmsNetId target, TimeSpan delay)
        {
            var data   = BitConverter.GetBytes((int)delay.TotalSeconds);
            var buffer = new ReadOnlyMemory <byte>(data);

            using (AdsClient client = new AdsClient())
            {
                client.Connect(new AmsAddress(target, AmsPort.SystemService));
                client.WriteControl(new StateInfo(AdsState.Shutdown, 1), buffer);
            }
        }