栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

如何检查客户端的网络/防火墙是否开放端口?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

如何检查客户端的网络/防火墙是否开放端口?

知道了!我已经解决了JSONP和jQuery AJAX调用的问题。我发现了

timeout
jQuery AJAX
的属性,并且当端口被阻塞或打开时,我的代码可以流畅地执行。这是未来访客的解决方案。感谢所有答复者的贡献。

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">        <script type="text/javascript" src="jquery-1.7.2-min.js"></script>    </head>    <body>        <script type"text/javascript"> var isAccessible = null; function checkConnection() {     var url = "http://101.212.33.60:1935/test/hello.html" ;     $.ajax({         url: url,         type: "get",         cache: false,         dataType: 'jsonp', // it is for supporting crossdomain         crossDomain : true,         asynchronous : false,         jsonpCallback: 'deadCode',         timeout : 1500, // set a timeout in milliseconds         complete : function(xhr, responseText, thrownError) {  if(xhr.status == "200") {     isAccessible = true;     success(); // yes response came, esecute success()  }  else {     isAccessible = false;     failure(); // this will be executed after the request gets timed out due to blockage of ports/connections/IPs  }         }    }); } $(document).ready( function() {     checkConnection(); // here I invoke the checking function });        </script>    </body></html>


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/486508.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号