I'm sending Apple Push Notifications.

The first 3 notifications works great. Then it stops to work. It happened the same yesterday and today. This is the error message I get:

“Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection refused) in /home/content/14/4875914/html/code/push/apns.php on line 15 Failed to connect 111 Connection refused ”

I've contacted my provider, and they told me the port 2195 is open.

How do I know if APN or my server is refusing the connection ?

How do I solve this ? As I wrote before, my code works in the beginning, so I assume certificates, code etc.. is correct.

link|improve this question

feedback

closed as off topic by SvenW, Shane Madden, mailq, Ward, Sam Oct 22 '11 at 9:33

Questions on Server Fault are expected to generally relate to servers, networking, or desktop infrastructure, within the scope defined in the faq.

1 Answer

Things on the Internet don't always work 100% perfectly every time you attempt them. This error message generally indicates the remote server refused the connection, but it's possible that it was "simulated" by a firewall or NAT device.

I would recommend doing two things:

1) Investigate the way the machine is set up. Does it have a local firewall? It is behind a proxy or NAT device? Who configured that device and how is it configured?

2) Add some code to sanely handle network errors. If you can't send a push notification right now, try again a bit later.

link|improve this answer
feedback

Not the answer you're looking for? Browse other questions tagged or ask your own question.