public static void LoadServices() { start = true; SQLiteClass sql = new SQLiteClass(SQLiteClass.ProgramFilesx86() + "\\DuckClient\\Information.dat"); rawServices = sql.GetServices(); spps = new List <ServicePlusStatus>(); List <Thread> threads = new List <Thread>(); foreach (ServicesObject so in rawServices) { Thread th = new Thread(() => HostScan.run(so)); th.Start(); threads.Add(th); } foreach (Thread th in threads) { th.Join(); } }
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); }