APNS : openssl s_client gethostbyname failure

apple-push-notifications, ios, openssl, push-notification

Solution

The correct name for sandbox is gateway.sandbox.push.apple.com, not gateway.sandbox.apple.com.

Problem

I'm trying to test the connection between my server & Apple's sandbox APNS server with the following command: ``` $ openssl s_client -connect gateway.sandbox.apple.com:2195 -cert cert.pem -key key.pem Enter pass phrase for key.pem: gethostbyname failure connect:errno=0 ``` What is the meaning of `gethostbyname failure`, and what is the cause? In the same server, telnet to port 2195 is working fine: ``` $ telnet gateway.push.apple.com 2195 Trying 17.149.36.242... Connected to gateway.push-apple.com.akadns.net. Escape character is '^]'. ``` UPDATE: If I use IP instead of host name, it works fine: ``` $ openssl s_client -connect 17.149.36.242:2195 -cert cert.pem -key key.pem ``` OpenSSL is unable to resolve DNS ?

Original source