Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firewall open port #7

Open
Tendoncs opened this issue Dec 15, 2014 · 2 comments
Open

Firewall open port #7

Tendoncs opened this issue Dec 15, 2014 · 2 comments

Comments

@Tendoncs
Copy link

New to the Git Stuff I will have to figure out how to make a new branch and update code there. But I found this bug. The software does not close the port it opens when it stops the server.

I created a DeleteFirewallRule

    private Task DeleteFirewallRule()
    {
        return Task.Run(() =>
        {
            string cmd = RunCMD("netsh advfirewall firewall show rule \"Screen Task\"");
            if (cmd.StartsWith("\r\nNo rules match the specified criteria."))
            {
            }
            else
            {
                cmd = RunCMD("netsh advfirewall firewall delete rule name=\"Screen Task\"");
                Log("Screen Task Rule was removed from your firewall");
            }
        });
    }

Added a call to it in the btnStartServer.Tag check.

        if (btnStartServer.Tag.ToString() != "start")
        {
            btnStartServer.Tag = "start";
            btnStartServer.Text = "Start Server";
            isWorking = false;
            isTakingScreenshots = false;
            Log("Server Stoped.");
            //Added
            await DeleteFirewallRule();
            return;
        }
@Tendoncs
Copy link
Author

Also, added "Rule removed" to log window.

Also Added Remove Firewall rule to the application close

@Tendoncs Tendoncs reopened this Dec 15, 2014
@ElBedeawi
Copy link
Collaborator

@Tendoncs a lot of users requires the port to stay open, but we can add an option to delete ports on exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants