2012-03-28 84 views
4

我要疯狂使用Apple推送通知! 我开发了我的应用程序和测试通知后,Ray Wanderlich教程和一切工作正常,直到我改变文件.pem与分配之一,并将连接字符串从gateway.sandbox.push-apple.com更改为gateway.push苹果。 COM。无法连接到ssl://gateway.push.apple.com:2195(连接超时)

现在,如果我尝试发送邮件服务器返回

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to  ssl://gateway.push.apple.com:2195 (Connection timed out) 
Failed to connect: 110 Connection timed out 

php文件和.pem文件是在TMDHosting:我试着问他们,如果端口号2195被关闭,因为谷歌搜索,我发现错误意味着端口被关闭。

虽然,我不明白错误是否链接到证书或服务器。

的奇怪的事情是,如果我遵循的程序与终端测试.pem文件,一切似乎工作

CONNECTED(00000003) 
    depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c)  2009 Entrust, Inc./CN=Entrust Certification Authority - L1C 
    verify error:num=20:unable to get local issuer certificate 
    verify return:0 
    --- 
    Certificate chain 
    0 s:/C=US/ST=California/L=Cupertino/O=Apple Inc/OU=Internet  Services/CN=gateway.push.apple.com 
     i:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c)  2009 Entrust, Inc./CN=Entrust Certification Authority - L1C 
    1 s:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c)  2009 Entrust, Inc./CN=Entrust Certification Authority - L1C 
     i:/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c)  1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048) 
--- 
Server certificate 
-----BEGIN CERTIFICATE----- 
    MIIEXTCC.......... 
-----END CERTIFICATE----- 
    subject=/C=US/ST=California/L=Cupertino/O=Apple Inc/OU=Internet   Services/CN=gateway.push.apple.com 
    issuer=/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c)  2009 Entrust, Inc./CN=Entrust Certification Authority - L1C 
    --- 
    No client certificate CA names sent 
    --- 
    SSL handshake has read 2541 bytes and written 2039 bytes 
    --- 
    New, TLSv1/SSLv3, Cipher is AES256-SHA 
    Server public key is 1024 bit 
    Secure Renegotiation IS supported 
    Compression: NONE 
    Expansion: NONE 
    SSL-Session: 
    Protocol : TLSv1 
    Cipher : AES256-SHA 
     Session-ID: 
     Session-ID-ctx: 
     Master-Key:  CBA98981BB512ED2FDF0C003F4556FDDA564BEBBEFC6528C37D8E0336BC141AEC6D7E014568B334B8330FFFE266E8CB4 
    Key-Arg : None 
    Start Time: 1332945845 
    Timeout : 300 (sec) 
    Verify return code: 0 (ok) 
--- 

这让我认为这不是一个问题。质子交换膜...

我错了吗?

我已经阅读了所有类似的问题,并尝试将端口号从2195更改为30,但没有任何更改。 提示?

编辑:我发现that,似乎等于我的问题:TMDHosting告诉我

...you are located under a shared hosting environment and opening a port for you will be not possible. However note that the address to which you are making a connection on port 2195 is not associate with our server. In other words you are trying to make a connection to a remote server on port 2195. In order to make this connection to the port specified above you should make sure that the port is opened for incoming connections on the remote server and not on the server on which your account with us relies.

我需要一个VPS?

EDIT2

在本教程中我跟着我发现

.. you will need a server that is connected to the internet. Push notifications are always sent by a server. For development you can use your Mac as the server (which we’ll do in this tutorial) but for production use, you need at least something like a VPS (Virtual Private Server). A cheap shared hosting account is not good enough. You need to be able to run a background process on the server, install an SSL certificate, and be able to make outgoing TLS connections on certain ports. Most shared hosting providers do not let you do this, although they might if you ask. However, I really recommend using a VPS host such as Linode.

最后我觉得我确实需要一个VPS。你能确定吗? 但是,为什么如果我发送推送通知与沙箱服务器它没有VPS正常工作?

最后更新:(希望能帮助别人)好像有一个错误,因为正确的事情是,我不能发送推送通知没有沙箱,也不从我的主机生产服务器(TMDHosting ):我的共享主机没有打开2195端口。改变提供者:一切正常。

+0

最后,你用什么提供商?,我有同样的问题:( – 2014-10-15 10:19:32

回答

0

Miwi,

感谢您的详细写作。

我们遇到了类似的问题,它使我们陷入了僵局。

当我们测试证书,它似乎工作,比其他: “验证错误:NUM = 20:无法获取本地颁发者证书”

无论如何,我们得到的命令行测试有效的握手openssl,就像你一样。

我们也可以让sandbox/dev cert工作。

您是否可以让我们知道您切换到哪个供应商,以防万一需要切换?

谢谢。

+0

我是意大利人:我问他们:http://www.devise.it/en一个域名(用一个专用的ip地址)我不知道他们是否能够帮助你,无论如何,我发现,通过谷歌搜索,你可以注册一个2195端口打开域的提供商很多,请看这里“http://stackoverflow.com/问题/ 1593820 /什么是最佳主机提供商的苹果推通知服务“。希望这可以帮助! – Miwi 2012-04-12 08:43:49

+0

Mille grazie,Miwi。 – user1328440 2012-04-12 21:56:21

相关问题