Babac
Babac

Reputation: 941

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.

Upvotes: 0

Views: 138

Answers (1)

battlmonstr
battlmonstr

Reputation: 6300

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.

Upvotes: 3

Related Questions