Ejemplo n.º 1
0
        private static void OnTick(object state)
        {
            DllEntry.ReconnectAllSockets();

            List <int> ports = DllEntry.GetArmaServerPorts();

            if (!ports.SequenceEqual(DllEntry.serverPorts))
            {
                DllEntry.serverPorts = ports;
                foreach (TcpClientEntry tcpClientEntry in DllEntry.tcpClients.Values)
                {
                    DllEntry.Send(tcpClientEntry.TcpClient, $"PORTS:{string.Join(":", DllEntry.serverPorts)}");
                }
            }
        }
Ejemplo n.º 2
0
        public static string Send(string data)
        {
            string[] dataParts = data.Split(new char[] { ':' }, 2);
            string   hash      = dataParts[0];

            data = dataParts[1];

            if (!DllEntry.tcpClients.ContainsKey(hash))
            {
                return("Socket for address not connected");
            }

            DllEntry.Send(DllEntry.tcpClients[hash].TcpClient, data);

            return("success");
        }