0

If I understand it correctly, Push Notifications are sent to port # 5223. Now, which server port we are talking about here. I am running my application on a device which is on some WiFi network.

I want to know the host name (IP address) of the server on whose port # 5223 Pushes are sent by APNS.

Abhinav
  • 37,684
  • 43
  • 191
  • 309
  • what are you trying to achieve by knowing IP? – Nilesh Feb 16 '12 at 05:36
  • I am not getting Push Notifications on one WiFi connection whereas it comes on another WiFi. – Abhinav Feb 16 '12 at 06:15
  • You need to open port 5223 on your firewall. See this: http://stackoverflow.com/questions/1950546/port-number-for-incoming-apple-push-notifications – Nilesh Feb 16 '12 at 08:25

2 Answers2

2

They are sent directly to your phone on port 5223, so APNS will send the IP of your phone. Your phone can have multiple IP addresses if it's on 3G and Wifi at the same time. So, it's not really possible to answer your question directly.

jsd
  • 7,673
  • 5
  • 27
  • 47
  • Any official documentation? Do you mean Apple will store all the IP address of the devices? doesn't sound making sense, as IP address changes from time to time. – Raptor Jun 19 '12 at 03:07
  • Sorry, I think I misread your question. You want to know the IP of the Apple server that is going to send you the push notification? – jsd Jun 19 '12 at 15:58
  • My question is : how does Apple locate a specific iPhone, as IP of iPhone changes from time to time? How does Apple route to the device? (maybe I should create a new question, though) – Raptor Jun 20 '12 at 02:10
  • Presumably the phone checks in with apple's servers on a regular basis. As far as I know, apple does not publish the details of the implementation. – jsd Jun 20 '12 at 16:22
  • if phone polls Apple server regularly, that's a pull mechanism, isn't it? – Raptor Jun 21 '12 at 02:14
  • Not really. The phone would be contacting Apple to tell it its device ID and IP address. Apple would then contact the phone when it has a push notification for it. It's actually push in both directions if you think about it. – jsd Jun 21 '12 at 16:28
  • I see. How about device without real IP ( those within NAT network ) ? Apple definitely doesn't know how to route through, unless a socket channel (or something like that) established... – Raptor Jun 22 '12 at 02:06
0

Apple answers your question very clearly here:

The APNs servers use load balancing. Your devices will not always connect to the same public IP address for notifications. The entire 17.0.0.0/8 address block is assigned to Apple, so it's best to allow this range in your firewall settings.

And to clarify the ports thingy, the devices use port 5223 to communicate to the APNs servers or port 443 as a fallback on Wi-fi only, when devices are unable to communicate to APNs on port 5223.

Mobiletainment
  • 22,201
  • 9
  • 82
  • 98