public void StartMonitor(ProxyMonitorReturn ret) { ThreadStart threads = new ThreadStart(() => this.Monitor(ret)); monitorthread = new Thread(threads); monitorthread.Start(); }
private void Monitor(ProxyMonitorReturn ret) { while (true) { Ping tester = new Ping(); PingReply reply = tester.Send(ip, 5); if (reply.Status == IPStatus.Success) { ret(reply.RoundtripTime.ToString() + "ms"); } else { ret(reply.Status.ToString()); } Thread.Sleep(3000); } }