unable to connect to ssl://gateway.sandbox.push.apple.com:2195 错误
使用APNS 搭建苹果推送服务器错误:unable to connect to ssl://gateway.sandbox.push.apple.com:2195 错误
1:检查你的服务器的端口 2195是否已经开启,是否被关闭了或是防火墙阻止了!这点很重要;
如果你不确定,又出现了错误,请先向你的服务器商询问一下,并开启;
2:确认你的证书没有问题:
在mac下执行 openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert apns-dev-cert.pem -key apns-dev-key-noenc.pem -debug -showcerts -CAfile "apns-dev.pem"
在上面进程执行完之后;可以随便输入一些字符串,如果关闭了,这时是正常的!如果没有关闭,会有错误信息打印;说明证书有问题;
证书生成:https://blog.serverdensity.com/how-to-build-an-apple-push-notification-provider-server-tutorial/
3:检查你的 推送程序是否有问题;
在这里推荐几个我测试成功的 php推送程序;
- https://github.com/blommegard/APNS-Pusher
- https://github.com/duccio/ApnsPHP
- https://github.com/manifestinteractive/easyapns
- 其他:
<?php //接收到设备发来的token,这里我手动填上。
$deviceToken = "c9d15180ff117c6540e0f21f8c13edae6a5a437e517acbac7bb740fd33b9b069";
//构造消息体
$body = array("aps" => array("alert" => 'this is test from push.cocoajin.org/p.php', "badge" => 1, "sound" => 'received5.caf'));
$ctx = stream_context_create();
stream_context_set_option($ctx, "ssl", "local_cert", "apns-dev.pem");
//建立socket连接
$fp = stream_socket_client("ssl://gateway.sandbox.push.apple.com:2195", $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
if (!$fp) { print "Failed to connect $err $errstrn"; return; }
print "Connection OK";
$payload = json_encode($body);
$msg = chr(0) . pack("n",32) . pack("H*", $deviceToken) . pack("n",strlen($payload)) . $payload;
print "sending message :" . $payload . "\n";
fwrite($fp, $msg);
fclose($fp); ?>
4:检查你的服务器与推送程序的环境配置是否相匹配;
比如我的服务器使用Apache ,程序用php 那么 就要确认服务器 支持php 的 socket连接 openSSL模块;
unable to connect to ssl://gateway.sandbox.push.apple.com:2195 错误的更多相关文章
- 关于svn获取获取文件时 Unable to connect to a repository at URL"https://..."执行上下文错误:参数错误
错误提示: 下面的六种解决方案都未能解决: 1.不提示输入用户名和密码,不管重装多少次都一样. 2.TortoiseSVN的setting->Saved Data->Authenticat ...
- codeigniter教程:Codeigniter出现Unable to connect to your databas
Codeigniter出现A Database Error Occurred错误 下午把项目构建到服务器上的时候,codeigniter竟然出现了 a database error occurred ...
- Unable to process request: General SSLEngine problem.Unable to connect to neo4j at `localhost:7687`, because the certificate the server uses has changed.
Exception in thread "main" org.neo4j.driver.v1.exceptions.ClientException: Unable to proce ...
- Unable to connect to web server 'IIS Express'(无法连接到Web服务器“IIS Express”)的解决方式-Jexus Manager
在运行微软示例工程eShopOnWeb时候, 在经过一段时间再运行启动报Error "Unable to connect to web server 'IIS Express'" ...
- 【API管理 APIM】APIM集成内部VNet后,自我访问出现(Unable to connect to the remote server)问题,而Remote Server正是APIM它自己
问题描述 在使用APIM配置内部VNET后,如API-1正常配置访问后端服务器的一个接口,而API-2则是通过调用APIM中的API-1来作为backendUrl,会出现500错误. 经过测试,目前这 ...
- telnet报“Unable to connect to remote host:Connection refused”错误
Linux下面telnet ip 端口号 报错误"Unable to connect to remote host:Connection refused"的时候,大部分是目标机的端 ...
- svn检出的时候报 Unable to connect to a repository at URL错误(摘自CSDN)
背景:1. SVN服务器:VisualSVN-Server-2.5.5: 2. SVN客户端:TortoiseSVN-1.7.6.22632-x64-svn-1.7.4.msi: 在S ...
- Error: unable to connect to node rabbit@mail: nodedown
某天,开启一个应用时,发现连接rabbitmq失败,本来想用rabbitmqctl来查看队列,结果提示“Error: unable to connect to node rabbit@mail: no ...
- SVN Unable to connect to a repository at UR
背景: 1. SVN服务器:VisualSVN-Server-2.5.5: 2. SVN客户端:TortoiseSVN-1.7.6.22632-x64-svn-1.7. ...
随机推荐
- Project interpreter not specified(eclipse+pydev) (转)
[小记] 最近因为想配置Android的开发环境,把原来的MyEclipse5.5删了,下载了最新的Eclipse3.7版本,因为之前在进行Python开 发,就下载了最新的Pydev2.4版本,安装 ...
- Centos安装Sun的JDK及测试
查询系统默认的JDK Centos系统(我vm上安装的是Centos6.3)默认会安装OpenJDK,要想使用默认的JDK,也需要你自己配置环境变量. 首先,检查系统是否安装有JDK并且OpenJDK ...
- CodeForces 738C Road to Cinema
二分答案. 油量越多,显然通过的时间越少.可以二分找到最小的油量,可以在$t$时间内到达电影院. 一个油箱容量为$v$的车通过长度为$L$的路程需要的最小时间为$max(L,3*L-v)$.计算过程如 ...
- 第5天:Ansible-Playbook
Ansible中的每个模块专注于某一方面的功能.虽然每个模块实现的功能都比较简单,但是,将各个模块结合起来就可以实现比较复杂的功能.在Ansible中,将各个模块组合起来的文件是一个YAML格式的配置 ...
- UML功能模型(用例图)
在UML系统开发中有三个主要的模型:功能模型(从用户角度展示系统的功能,包括用例图).对象模型(采用对象,属性,操作关联等概念展示系统的结构和基础,包括类图.对象图.包图).动态模型(展示系统 ...
- 【POJ 2409】Let it Bead
http://poj.org/problem?id=2409 Burnside引理:设\(G\)是\(X\)的置换群,而\(\mathcal{C}\)是\(X\)中一个满足下面条件的着色集合:对于\( ...
- 【动态规划】CDOJ1271 Search gold
方格取数. 但由于题意说金币数<0就死了,就不能继续转移. #include<cstdio> #include<algorithm> #include<cstrin ...
- 【SAM】BZOJ2882-工艺
[题目大意] 求一个循环数列的最小表示法. [思路] 最小表示法的正解:★ SAM乱搞,和前面的POJ那道一样.然而MLE了,当作学习一下map的用法^ ^ map的使用方法(来源:☆) 一.map的 ...
- 企鹅----sap+裂点
企鹅 题目描述 在靠近南极的某处,一些企鹅站在许多漂浮的冰块上.由于企鹅是群居动物,所以它们想要聚集到一起,在同一个冰块上.企鹅们不想把自己的身体弄湿,所以它们在冰块之间跳跃,但是它们的跳跃距离,有一 ...
- django查询
阅读目录 大于.大于等于 小于.小于等于 在...范围内 模糊查询 是否为空 不等于/不包含于 大于.大于等于 1 2 3 4 5 __gt 大于 __gte 大于等于 User.objects. ...