title: APNS stream_socket_client failed with errno=0 and errMsg=''
body: <pre><code>function getConnection($certPemFile)
  {
      $ctx = stream_context_create();
      stream_context_set_option($ctx, 'ssl', 'local_cert', $certPemFile);
      $dsn = 'ssl://'.'gateway.push.apple.com:2195';
      $socket = stream_socket_client($dsn, $errno, $errMsg, 3, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);
      if(!$socket) {
          printf("errno=%d  errMsg=%s", $errno, $errMsg);
      }
      return $socket;
  }
  </code></pre>
  
  <p>I connect to the APNS server with this code, but <strong>sometimes</strong> it returns <code>$errno=0</code> and <code>$errMsg=''</code>.</p>
  
  <p>I have updated the .pem files.</p>