Ejemplo n.º 1
0
        void unsafeChangePortCheckStatus(Network.PortChecker.CheckPortCompletedEventArgs e)
        {
            HideActivityMask();
            btnAddPortForwardingRules.Enabled = true;  // unless we change it to false

            if (!e.DidComplete)
            {
                ChangeBlurbText("Remote Potato was unable to test whether Internet connections are getting through to this computer from outside your home network.\r\n\r\n" +
                                "Your router may need to be set up to allow this.  ('port forwarding')  Remote Potato can try to automatically set up your router for you using UPnP technology.\r\n\r\n" +
                                "You may skip this step if you prefer to set up your router manually later, if your router doesn't support UPnP or if you won’t be using Remote Potato over the Internet.\r\n\r\n" +
                                "If unsure, answer 'Yes'.");
            }
            else
            {
                if (e.PortOpen)
                {
                    ChangeBlurbText("Remote Potato determined that your router is correctly set up to allow access from outside your home network.");
                    btnAddPortForwardingRules.Enabled = false;
                }
                else
                {
                    ChangeBlurbText("Remote Potato has checked and Internet connections are not getting through to this computer from outside your home network.\r\n\r\n" +
                                    "The most likely reason is that your router has to be set up to allow this. ('port forwarding')  Remote Potato can try to automatically set up your router for you using UPnP technology.\r\n\r\n" +
                                    "You may skip this step if you prefer to set up your router manually later, if your router doesn't support UPnP or if you won’t be using Remote Potato over the Internet.\r\n\r\n" +
                                    "If unsure, answer 'Yes'.");
                }
            }
        }
Ejemplo n.º 2
0
        void UnsafeCheckPortOpenCompleted(Network.PortChecker.CheckPortCompletedEventArgs e)
        {
            pbCheckNet.Visible = false;

            if (!e.DidComplete)
            {
                lblCheckNet.Text      = "Could not check whether Remote Potato can be accessed over the Internet";
                lblCheckNet.ForeColor = Color.Maroon;
            }
            else if (e.PortOpen)
            {
                lblCheckNet.Text      = "Port is open - Remote Potato can be accessed over the Internet";
                lblCheckNet.ForeColor = Color.DarkGreen;
            }
            else
            {
                lblCheckNet.Text      = "Port is not open - Remote Potato cannot be accessed over the Internet";
                lblCheckNet.ForeColor = Color.Maroon;
            }

            isInitialised = true;
        }
Ejemplo n.º 3
0
        void checker_CheckPortOpenAsync_Completed(object sender, Network.PortChecker.CheckPortCompletedEventArgs e)
        {
            CheckPortOpenCompleted d = new CheckPortOpenCompleted(UnsafeCheckPortOpenCompleted);

            this.Invoke(d, e);
        }
        private void CheckPortForwarding()
        {
            /*  THIS IS A PROPER CHECK FOR INTERNET ACCESS FROM OUTSIDE, UNFORTUNATELY MY ROUTER FAILS BECAUSE THE TEST SERVER TCPLISTENER HANGS AROUND IN ITS ROUTING TABLE AND CAUSES IT TO FAIL WHEN ADDING THE FORWARDING RULE
            Network.PortChecker pChecker = new Network.PortChecker();
            pChecker.CheckPortOpenAsync_Completed += new EventHandler<Network.PortChecker.CheckPortCompletedEventArgs>(pChecker_CheckPortOpenAsync_Completed);
            pChecker.CheckPortOpenAsync(Convert.ToInt32(Settings.Default.Port), true);

             SO, INSTEAD, JUST CHECK VIA UPNP MAPPINGS:

             */
            if (nathelper == null) return;
            PortChecker.CheckPortCompletedEventArgs args = null;
            string txtError = "";

            if (!nathelper.GatewayFound)
            {
                if (!nathelper.Discover(ref txtError))
                {
                    HideActivityMask();
                    ChangeBlurbText("Remote Potato could not find a UPnp router on your local network.\r\n\r\nDo you have a router?  If so, click the button below to attempt to set up your router anyway; if this fails, you will be given instructions on manual setup.");
                    return;
                }
            }

            if (nathelper.RPMappingsExist(LocalIP))
            {
                args = new PortChecker.CheckPortCompletedEventArgs(true, true, "");
            }
            else
            {
                args = new PortChecker.CheckPortCompletedEventArgs(true, false, "");
            }

            changePortCheckStatus(args);
        }
Ejemplo n.º 5
0
 void pChecker_CheckPortOpenAsync_Completed(object sender, Network.PortChecker.CheckPortCompletedEventArgs e)
 {
     changePortCheckStatus(e);
 }