title: APNS : openssl s_client gethostbyname failure
body: <p>I'm trying to test the connection between my server &amp; Apple's sandbox APNS server with the following command:</p>
  
  <pre><code>$ 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
  </code></pre>
  
  <p>What is the meaning of <code>gethostbyname failure</code>, and what is the cause?</p>
  
  <p>In the same server, telnet to port 2195 is working fine:</p>
  
  <pre><code>$ telnet gateway.push.apple.com 2195
  Trying 17.149.36.242...
  Connected to gateway.push-apple.com.akadns.net.
  Escape character is '^]'.
  </code></pre>
  
  <p><strong>UPDATE:</strong> If I use IP instead of host name, it works fine:</p>
  
  <pre><code>$ openssl s_client -connect 17.149.36.242:2195 -cert cert.pem -key key.pem
  </code></pre>
  
  <p>OpenSSL is unable to resolve DNS ?</p>