コード例 #1
0
        public static VersionGUIDPair GetVersionAndGUID()
        {
            IMClient iM = new IMClient();

            iM.setConnParams(ServiceConnectionDelegator.GetService().IPAddress, 25567);
            iM.SetupConn();
            String aguid = iM.RequestParam(IMClient.IM_GetIdentity);

            iM.Disconnect();
            iM.SetupConn();
            String aversion = iM.RequestParam(IMClient.IM_GetVersion);

            return(new VersionGUIDPair {
                Version = aversion, GUID = aguid
            });
        }
コード例 #2
0
        private static List <GUIDMACVersionIP> GetActiveHosts()
        {
            MSSQL                   ms    = new MSSQL();
            List <String>           ips   = ms.GetIPs();
            int                     max   = ips.Count;
            List <GUIDMACVersionIP> gmvis = new List <GUIDMACVersionIP>();

            IPPS = new List <IPPlusStatus>();

            List <Thread> threads = new List <Thread>();

            foreach (String ip in ips)
            {
                Thread th = new Thread(() => HostScan.run(ip, 25567));
                th.Start();
                threads.Add(th);
            }

            foreach (Thread th in threads)
            {
                th.Join();
            }

            //The response of every ping
            for (int i = 0; i <= count; i++)
            {
                try
                {
                    IPPlusStatus iss = IPPS[i];

                    if (iss.Status == KnownHost.STATE_ONLINE)
                    {
                        IMClient iMC = new IMClient();
                        iMC.setConnParams(iss.IP, 25567);

                        iMC.SetupConn();
                        string guid = iMC.RequestParam(IMClient.IM_GetIdentity);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string version = iMC.RequestParam(IMClient.IM_GetVersion);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string mac = iMC.RequestParam(IMClient.IM_GetMAC);
                        iMC.CloseConn();
                        iMC.SetupConn();

                        string hostname = iMC.RequestParam(IMClient.IM_GetHostname);

                        GUIDMACVersionIP gmvi = new GUIDMACVersionIP
                        {
                            GUID     = guid,
                            IP       = iss.IP,
                            MAC      = mac,
                            Version  = version,
                            Hostname = hostname
                        };
                        gmvis.Add(gmvi);
                    }
                }
                catch (Exception)
                {
                }
            }
            return(gmvis);
        }