如何在Windows中检测防火墙?

编程入门 行业动态 更新时间:2024-10-26 02:35:30
本文介绍了如何在Windows中检测防火墙?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的应用需要向网站发出GET请求,我希望能够知道它是否被防火墙阻止,并要求用户添加例外。

My app needs to make a GET request to a website and I'd like to be able to know if it's being blocked by a firewall, and ask the user to add an exception.

如何通过防火墙而不是其他方式找出我的获取请求失败?

How can I find out that my get request failed because of a firewall, instead of something else?

推荐答案

如果它是一个好的防火墙,你不能。在其他选项中,防火墙可以:

If it's a good firewall, you can't. Among other options, a firewall can:

  • 回复几种不同的 ICMP 消息,指示无法访问目标,或
  • 以静默方式丢弃请求,从而导致超时。
  • reply with one of several different ICMP messages, indicating the destination is not accessible, or
  • silently discard the request, resulting in a timeout.

一个合理的选择是解释为什么应用程序无法访问该网站,并提供一些有用的建议:

A reasonable option is to explain why the app was unable to access the website, and provide some helpful suggestions:

No response from www.site: * Your computer may not be connected to the Internet. * The site may be down. * The site may be blocked by a firewall.

The network indicated that www.site is not accessible: * Helpful messages go here.

重要的一点是,在失败的类型之间区分,或许比我更好,他们背后的原因。例如,故障排除无响应的步骤将与故障排除设备告诉我它没有在该端口上侦听的步骤不同。

The important point is to differentiate, perhaps better than I did above, between the types of failure, and the reasons behind them. For example, the steps for troubleshooting "no response" will be different from those for troubleshooting "the device told me it's not listening on that port."

更多推荐

如何在Windows中检测防火墙?

本文发布于:2023-08-06 04:40:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310127.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:防火墙   如何在   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!