Ejemplo n.º 1
0
 public static async Task RestartAsync(AmsNetId target, CancellationToken cancel)
 {
     using (AdsClient client = new AdsClient())
     {
         client.Connect(new AmsAddress(target, AmsPort.SystemService));
         await client.WriteControlAsync(AdsState.Reset, 0, cancel);
     }
 }
Ejemplo n.º 2
0
        public static async Task RebootAsync(AmsNetId target, TimeSpan delay, CancellationToken cancel)
        {
            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));
                await client.WriteControlAsync(AdsState.Shutdown, 1, buffer, cancel);
            }
        }