[GH-ISSUE #7] Firewall open port #80

Open
opened 2026-03-07 21:30:32 +03:00 by kerem · 0 comments
Owner

Originally created by @Tendoncs on GitHub (Dec 15, 2014).
Original GitHub issue: https://github.com/EslaMx7/ScreenTask/issues/7

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;
        }
Originally created by @Tendoncs on GitHub (Dec 15, 2014). Original GitHub issue: https://github.com/EslaMx7/ScreenTask/issues/7 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; } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ScreenTask#80
No description provided.