Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

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

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

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.

share|improve this answer

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