浏览器为什么阻止某些端口

浏览器为什么阻止某些端口

本文介绍了浏览器为什么阻止某些端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我在使用WebSockets玩弄和它的出现,与原生的WebSocket支持所有浏览器我(Safari浏览器,Chrome浏览器)测试阻止某些端口。如果我尝试通过80端口连接到服务器,everyting工作正常。如果我尝试其他的端口,比如81,82或1000,连接prematurely关闭,因为没有什么的另一端。这是预期的行为,它精美的作品。

I'm playing around with websockets and it appears, that all browsers with native websocket support I tested with (Safari, Chrome) block some ports. If I try to connect to my server over port 80, everyting works fine. If I try other ports, like 81, 82 or 1000, the connection is prematurely closed because there's nothing on the other end. That's the expected behaviour and it works beautifully.

但是,对于某些端口(如20,37或79),Chrome开发者控制台只是说 WebSocket的端口79受阻,但我的JS code没有按'收不到这方面有任何的信息(甚至没有某种超时)。 Safari是一个小更详细和评论 SECURITY_ERR:DOM异常18:试图通过用户代理的安全策略,打破

However, with some ports (such as 20, 37 or 79), the Chrome developer console simply says WebSocket port 79 blocked but my JS code doesn't receive any information about this (not even some sort of timeout). Safari is a little more verbose and comments SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy of the user agent.

所以我的问题是:

如何可靠地检测到一个端口被封锁?
我必须设置超时并手动检查?这似乎并没有被去了解它的最聪明的方式,尽管它可能是做跨浏览器的唯一途径。

How can I reliably detect that a port is blocked?
Do I have to set a timeout and check that manually? That doesn't seem to be the smartest way to go about it, although it might be the only way to do it cross-browser.

我在哪里可以找到阻塞端口?
我的谷歌搜索列表不转了有用的东西,很遗憾。

Where can I find a list of the blocked ports?
My Google search didn't turn up anything useful, unfortunately.

为什么被阻挡在首位这些端口?

在此先感谢!

推荐答案

好吧,我找到了答案。有时候,你看不到树木,不见森林。

Okay, I found the answer. Sometimes you just don't see the forest for the trees.

首先,处理阻塞端口的情况下,实在是微不足道。一个简单的的try / catch 的伎俩。我只是顺便说一句迷惑铬显示的异常,并且不承认它是这样马上(我通常使用Firefox)。

First off, handling cases of blocked ports is trivial. A simple try/catch does the trick. I was simply confused by the way Chrome displayed that exception and didn't recognize it as such right away (I usually use Firefox).

其次,明确指出,

如果端口是该用户代理配置为阻止访问的端口,然后抛出一个异常SECURITY_ERR。 (用户代理通常阻止访问如SMTP众所周知的端口)。

哪些端口正是由这意味着似乎是到浏览器的WebSocket实现。我的测试显示,Chrome和Safari阻止以下端口(仅低于1024的端口进行测试):

What ports exactly are meant by that appears to be up to the browser's Websocket implementation. My tests have shown that Chrome and Safari block the following ports (only ports below 1024 were tested):


  • 1:TCPMUX

  • 7:ECHO协议

  • 9:放弃协议

  • 11:SYSTAT服务

  • 13:日间协议

  • 15:用netstat服务

  • 17:每日报价

  • 19:字符发生器协议

  • 20:FTP

  • 21:FTP

  • 22:SSH

  • 23:远程登录

  • 25:SMTP

  • 37:TIME协议

  • 42:域名服务器/ WINS

  • 43:WHOIS

  • 53:DNS

  • 77:RJE服务

  • 79:手指

  • 87:链接

  • 95:SUPDUP

  • 101:NIC主机名

  • 102:ISO-TSAP

  • 103:gppitnp

  • 104:ACR / NEMA

  • 109:POP2

  • 110:POP3

  • 111:SunRPC

  • 113:IDENT

  • 115:SFTP

  • 117:UUCP路径服务

  • 119:NNTP

  • 123:NTP

  • 135:微软EPMAP

  • 139:NetBIOS会话服务

  • 143:IMAP

  • 179:BGP

  • 389:LDAP

  • 465:思科协议。

  • 512:通信卫星

  • 513:远程登录

  • 514:系统日志

  • 515:行式打印机后台程序

  • 526:节奏

  • 530:RPC

  • 531:IRC

  • 532:网络新闻

  • 540:UUCP

  • 556:RFS

  • 563:NNTPS

  • 587:SMTP

  • 601:未知

  • 636:LDAPS

  • 993:IMAPS

  • 995:POP3S

相关的服务是由TCP和UDP端口号对Wikipeda.

The associated services are taken from the list of TCP and UDP port numbers on Wikipeda.

这篇关于浏览器为什么阻止某些端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 13:51