简体   繁体   English

ping www.apple.com端口

[英]Pinging www.apple.com ports

I building small utility iOS App with GCDAsyncSocket that will ping ports on www.apple.com: list of ports . 我使用GCDAsyncSocket构建小型实用程序iOS App,它将对www.apple.com: 端口列表上的端口执行 ping操作。

For example, trying to connect on TCP port 80 and 443 I got "connected" status, but when I try 2195 and 2196 I get "timeout". 例如,尝试在TCP端口80和443上连接时,我的状态为“已连接”,但是当我尝试2195和2196时,则为“超时”。

When trying to connect to ports with GCDAsyncUdpSocket, whichever port I try to connect I get "connected", even though some ports aren't open (tested with nmap which returns "closed"). 当尝试使用GCDAsyncUdpSocket连接到端口时,无论我尝试连接的哪个端口,我都会“连接”,即使某些端口未打开(使用nmap测试后返回“关闭”)。

So, I have couple of questions: 因此,我有几个问题:

1) Am I doing something wrong when trying to connect to ports 2195, 2196, etc? 1)尝试连接到端口2195、2196等时,我做错什么了吗?

2) Is GCDAsyncUdpSocket reliable? 2)GCDAsyncUdpSocket是否可靠? Whatever I try with it, it passes. 无论我尝试什么,它都会过去。

You have several misconceptions here: 您在这里有一些误解:

  1. You shouldn't try to connect to a lot of ports on a server that is not yours unless you are authorized to do that. 除非获得授权,否则您不应尝试连接到非您服务器上的许多端口。 This is called pentesting , and it is at minimum not nice if not illegal. 这称为渗透测试 ,如果不是非法的话,至少是不好的。
  2. The list of ports you refer to is not about "www.apple.com", it is about Apple products in general, so like any macOS computers. 您所指代的端口列表与“ www.apple.com”无关,而与苹果产品一样,与苹果产品一样。 You can use a computer of your friend to try that. 您可以使用您朋友的计算机进行尝试。 Or a virtual machine on your own computer. 或您自己计算机上的虚拟机。
  3. UDP protocol doesn't have a "connected" state. UDP协议没有“连接”状态。 The big difference between UDP and TCP is that TCP has connections support while UDP doesn't. UDP和TCP之间的最大区别是TCP具有连接支持,而UDP没有。 The "connected" state of GCDAsyncUdpSocket is probably fake. GCDAsyncUdpSocket的“连接”状态可能是假的。

See this about detecting if an UDP port is open or not. 有关检测UDP端口是否打开的信息, 请参见此内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM