iPhone: Connection refused error while connection Apple's Push Notification Service - iphone

I have been scratching my head since long now to get rid of following error message.
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused)
I have tried multiple times generating the correct certificate and made sure that project is signed with the correct bundle identifier.
I have also tried using testing script PHP(https://devforums.apple.com/message/50461) and Python (http://stackoverflow.com/questions/1052645/apple-pns-push-notification-services-sample-code) but both are giving same error message.
Could anyone please help me to know how to get rid of this error message?
Thanks.

Gotcha...Our firewall setup to not allow any other ports not listed in settings. Asked admin people to add it and it doesn't show this error message now....!! I have sent and message but didn't receive since last 5 minutes. I know that APNS messages are not guaranteed. Will wait for some more time. Hopefully it arrives.. :)

Related

Error in teletype for atom: Connecting to peer timed out

I'm working on a group project using teletype, but when one of my peers tries to connect to the portal I opened, they just get the error "Connecting to peer timed out". When I try and connect to the portal my peer created, the application says something similar.
I know this is more of a logistics question, but is there any way to fix this? I haven't really been able to find a solution.

Visual Studio 2017 unable to connect to Nuget

i have a problem,
when i tried to Manage Nuget Packages VS2017 showed me this message:
[nuget.org] Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The underlying connection was closed: An unexpected error occurred on a send.
Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Please can you help me to solve this problem??
I'm going crazy
Thank you
That is a bug in VS 2017. (I had the same problem). This has been fixed in VS version 15.1 . To fix this problem update your VS through vs_Community.exe installer (which you can download here).

Apple Push Notification not working on shared server

I want to send APN (Apple Push Notification) from PHP script. My PHP script is working fine and I receive notification in the iphone device as well when sending from localhost but when I upload the same script with same .pem file to the shared server it returns error...
Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused) in /mypath/SendPushNotification.php on line 28 Failed to connect: 111 Connection refused
From some source I get to know that to send APN port 2195 must be open which is not possible in the shared server plan. So I tried using dedicated server and it's working perfectly and I receive the notification on the device. I tried hard to find the solution for shared server but didn't find any solution.
My question: is it possible send APN without opening port 2195 from shared server? if Yes give some guidance.
No, Its not possible to send APN message without using 2195 port.
If you want to send push notification message from shared server, try using some third party tools like http://urbanairship.com/.
Some time ago I got the same error, and then I found that it ocurres because of the server, the proxy is blocking that port, because most of servers doesn't use that port as a common one(80 or 21).
In this case you could try asking for support on your server reseller , they can open that port (2195) for you, If your take this solution I would recommend also asking to open the port 2196 that port is used for feedback.
Another solution is to use a free push notification provider, like Parse which is really easy to use and implement on your app, also you can use UrbanAirship, but I preffer Parse ;)
Hope it helps
This is irritating and definitely port 2195 issue. Chat with your hosting provider and ask them to open the port. I also had same issue. My Local code was running peacefully in every condition like sandbox and production but it was failing on the server.
Dont get confused about .pem file path and that would be simple corresponding to your code. For me i put my certificates (.pem) in a directory named certs and gave path like this:
$apnsCert = 'certs/cert_prod.pem';
The code was not working on my apps production server. I wasted one and a half day on this but that ran great on first run when i put that on application's staging server. Reason!!!! Definitely port 2195 issue.
All the beat.

Dealing with intermittent Winsock errors

My client app gets intermittent winsock errors (10060, 10053) against one particular server we interface with. I have it re-trying the request that failed, but sometimes it fails repeatedly, and I give up after 5 re-tries. Would it be likely to help at all if I closed the socket and created a new one? (I know nothing about the server-side.)
Ok, so the errors that you're getting are:
10060 - WSAETIMEDOUT
10053 - WSAECONNABORTED
When do you get them? What are you doing at the time?
You get a WSAECONNABORTED when the remote end of the connection, or possibly an intermediary router, resets the connection and sends an RST. This could simply be the remote end issuing a non lingering close or it could be the remote end aborting or crashing.
You can't continue doing anything with a connection that has had a WSAECONNABORTED on it as the connection has been aborted and is no more; it is a dead connection, it has passed on...
Context matters immensely as to why you might get a WSAETIMEDOUT exception and the context will dictate if retrying is sensible or not.
One thing I would try is- do tracert to your server.
Often when someone is connected through VPN; you may see this error because your local and remote ip addresses overlap.
e.g. if your local ipaddress range is 192.168.1.xxx and vpn remote range is also 192.168.1.xxx you will also see this error.
sharrajesh

How we can check that our IP is blocked by apple from using APNS service

My apns was fine till yesterday. But today onwards am getting this error.
.Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection timed out)
I didn't change anything. I am using an adhoc distribution profile.I used apns service too many times for testing. So i am confused about whether apple blocked my ip.How we can check that our IP is blocked by apple from using APNS service ?
Which version you are using? If it is 5.2, please test with 5.3
If you are using 5.3, then please make sure whether SSL is on or off (enabled or not).
While I can't help you check your IP addresses (well, aside from trying a new IP, or proxy), here are some things you can try to restore your APNS ability.
I would check your push certificate. It may have expired.
Also, look into Urban Airship. UA is a great service that helps you with using APNS. I have seen them mention Sandbox control specifically to avoid your problem of pushing the limit. (pun intended.)
EDIT:
Based on the last part of your error, (Connection Timeout), it does not look like an IP block. It would say (Connection refused).