예제 #1
0
        void OnScanPortsClick(object sender, EventArgs e)
        {
            view.Log += "Scanning for open port on " + view.EndpointIP + ". This may take a few minutes..." + Environment.NewLine;

            Thread scannerThread = new Thread(new ThreadStart(() =>
            {
                NetworkScanner scanner = new NetworkScanner();
                IList<int> openPorts = scanner.GetOpenPorts(view.EndpointIP, 2999, 3001);
                view.Log += "Found " + openPorts.Count + " open ports:" + Environment.NewLine;
                foreach (int openPort in openPorts)
                {
                    view.Log += openPort + Environment.NewLine;
                }
            }));
            scannerThread.IsBackground = true;
            scannerThread.Start();
        }