简体   繁体   中英

Pinging www.apple.com ports

I building small utility iOS App with GCDAsyncSocket that will ping ports on www.apple.com: list of ports .

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".

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").

So, I have couple of questions:

1) Am I doing something wrong when trying to connect to ports 2195, 2196, etc?

2) Is GCDAsyncUdpSocket reliable? 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. 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. The big difference between UDP and TCP is that TCP has connections support while UDP doesn't. The "connected" state of GCDAsyncUdpSocket is probably fake.

See this about detecting if an UDP port is open or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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