【问题标题】:Port 2195 open but cannot access APNS server2195端口打开但无法访问APNS服务器
【发布时间】:2013-03-13 07:51:01
【问题描述】:

问题: 我无法访问 APNS 服务器。我收到 110 连接超时错误。

我的情况:

  1. 我已经联系了我的主人 (hostmonster)。他们说我的 2195,2196 端口已经开放了。
  2. 我的证书和密码没有问题,因为我已经在本地 Mac 上对其进行了测试。
  3. 我用一个很简单的PHP来测试。这是我的代码:

    $ctx = stream_context_create();
    stream_context_set_option($ctx, 'ssl', 'local_cert', 'apn.pem');
    stream_context_set_option($ctx, 'ssl', 'passphrase', 'aaa');
    $fp = stream_socket_client("ssl://gateway.sandbox.push.apple.com:2195", $err,     
          $errstr,60,STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT,$ctx);
    
    if ($fp)
        echo ('aa');
    else
        echo ($err.$errstr);
    

【问题讨论】:

    标签: php ssl ssl-certificate apple-push-notifications apns-php


    【解决方案1】:

    我遇到了同样的问题,但使用的是 Bluehost。就我而言,事实证明 Bluehost 防火墙没有正确打开。 Bluehost 的第一线聊天支持说端口 2195 和 2196 是开放的,问题不在于它们。为了证明问题在他们这边,我让他们从 Bluehost 服务器运行以下 telnet 命令:

    telnet gateway.push.apple.com 2195
    
    Trying 17.149.36.246...
    Trying 17.149.35.166...
    Trying 17.149.35.170...
    Trying 17.149.35.177...
    ... Connection timed out
    

    输出应该是:

    telnet gateway.push.apple.com 2195
    
    Trying 17.149.36.230...
    Connected to gateway.push.apple.com.
    Escape character is '^]'.
    

    然后我向 Bluehost 提交了包含此信息的支持票。他们通过正确打开防火墙在 6 小时内解决了问题。

    【讨论】:

    • 这对我很有帮助,很棒的 Greg
    猜你喜欢
    • 1970-01-01
    • 2012-11-16
    • 2021-09-05
    • 2021-06-22
    • 2016-12-08
    • 1970-01-01
    • 2014-03-31
    • 1970-01-01
    • 2010-12-21
    相关资源
    最近更新 更多