private static async Task CheckShutdownInstruction()
        {
            List <string> machineMacList = new List <string>();

            try
            {
                lock (WaitList)
                {
                    machineMacList = WaitList.Where(x => DateTime.Now.Subtract(x.Value).Minutes > 2).Select(x => x.Key).ToList();
                    foreach (string m in machineMacList)
                    {
                        AsynchronousMachineServer.ReceiveMacFromDesktop(m, "SystemOff");
                        WaitList.Remove(m);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        private static int DecodeDataDesktop(Dictionary <string, string> data, Socket sock)
        {
            string d = "";
            Dictionary <string, string>   DatatoSend = new Dictionary <string, string>();
            KeyValuePair <string, string> r          = new KeyValuePair <string, string>();

            try
            {
                if (data["Type"] == "MacAddress")
                {
                    //Log("mac received " + data["value"]);
                    var           mac = data["value"].Split(',');
                    GetMacAddress gt  = new GetMacAddress();
                    r = gt.GetMac(mac);

                    if (r.Key != null)
                    {
                        if (!DesktopList.Contains(r))
                        {
                            DesktopList.Add(r.Key, r.Value);
                        }
                        lock (Clients)
                        {
                            if (Clients.ContainsKey(sock))
                            {
                                var client = Clients[sock];
                                client.MacAddress = data["value"].ToUpper();
                            }
                        }
                    }
                    else
                    {
                        // Log("mac from database key: " + r.Key + " value: " + r.Value);
                        DatatoSend.Add("Type", "Reply");
                        DatatoSend.Add("Status", "404");

                        var    s = JsonSerializer.Serialize(DatatoSend);
                        byte[] b = Encoding.ASCII.GetBytes(s);
                        Send(sock, b);
                        ClearSocketDesktop(sock);
                    }
                    //SendToDesktop(r.Key, r.Value, "Shutdown");
                }
                if (data["Type"] == "Command")
                {
                    var code  = data["Code"];
                    var ccmac = data["CCmac"];
                    // Log("received " + code + " for machine with mac " + ccmac);
                    if (code == "Shutdown")
                    {
                        Instructions ins = new Instructions();
                        d = "SystemOffS";
                    }
                    try
                    {
                        AsynchronousMachineServer.ReceiveMacFromDesktop(ccmac, d);
                    }
#pragma warning disable CS0168 // The variable 'ex' is declared but never used
                    catch (Exception ex)
#pragma warning restore CS0168 // The variable 'ex' is declared but never used
                    {
                        //Log(" Decode Desktop Data exception under send data to machine " + " " + ex.Message + " " + ex.StackTrace);
                        // Console.WriteLine(ex.Message);
                    }
                }
            }
            catch (Exception ex)
            {
                // Log(" Decode Desktop Data exception 2 " + " " + ex.Message + " " + ex.StackTrace);
                //  ClearSocketDesktop(ip, ((IPEndPoint)sock.RemoteEndPoint).Port);
            }
            return(1);
        }