Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6328661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:29:58+00:00 2026-05-24T17:29:58+00:00

How do i check if specific port is blocked by Windows firewall , both

  • 0

How do i check if specific port is blocked by Windows firewall , both in incoming and outgoing connections.

I’ve seen code samples such as this one:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

Dim host As String = "localhost"

Dim port As Integer = 6900

Dim addr As IPAddress = CType(Dns.GetHostAddresses(host)(0), IPAddress)

Try

Dim tcpList As New TcpListener(addr, port)

tcpList.Start()

Catch sx As SocketException

' Catch exception here if port is blocked

End Try

End Sub

But how can i know if the exception is thrown specifically because of firewall blocking, and not because of other socket errors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:29:59+00:00Added an answer on May 24, 2026 at 5:29 pm

    I’d say that the proper way to check if Windows Firewall is blocking a port isn’t to test it, but to use the Windows Firewall API to check conclusively.
    I’ve never used it but I’d assume that INetFwOpenPorts would be the place to start.

    Here’s a VB.Net code sample that seems to contain code that does this. Specifically I’d suggest looking at the IsxPLportOpen method in that sample which uses the GloballyOpenPorts method to get a reference to INetFwOpenPorts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have some code to check a specific directory to see if an
How can I check a string in php for specific characters such as '#'
This is a specific version of this question . I want to check if
Using Java, how do I check if a specific TCP/IP port is open and
Our application is a C server (this problem is for the Windows port of
I've seen this post which describes how to use the graph api to check
I need to check specific positions in an NSArray to see if they have
On a daily basis, a person needs to check that specific workbooks have been
How do i check out a specific directory from CVS and omit the tree
I need to check if a specific login already exists on the SQL Server,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.