vb.net - Check if port is blocked by windows firewall -
how check if specific port blocked windows firewall , both in incoming , outgoing connections.
i've seen code samples such one:
protected sub button1_click(byval sender object, byval e eventargs) dim host string = "localhost" dim port integer = 6900 dim addr ipaddress = ctype(dns.gethostaddresses(host)(0), ipaddress) try dim tcplist new tcplistener(addr, port) tcplist.start() catch sx socketexception ' catch exception here if port blocked end try end sub
but how can know if exception thrown because of firewall blocking, , not because of other socket errors?
i'd proper way check if windows firewall blocking port isn't test it, use windows firewall api check conclusively.
i've never used i'd assume inetfwopenports place start.
here's vb.net code sample seems contain code this. i'd suggest looking @ isxplportopen
method in sample uses globallyopenports method reference inetfwopenports
.
Comments
Post a Comment