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. ...
随机推荐
- POJ3468 A Simple Problem with Interger [树状数组,差分]
题目传送门 A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 1 ...
- mysql索引之七:组合索引中选择合适的索引列顺序
组合索引(concatenated index):由多个列构成的索引,如create index idx_emp on emp(col1, col2, col3, ……),则我们称idx_emp索引为 ...
- [BZOJ 1855] 股票交易
Link: BZOJ 1855 传送门 Solution: 比较明显的$dp$模型 令$dp[i][j]$为第$i$天持有$j$支股票时的最大利润 对其购买股票和售出股票分别$dp$,这里以购买为例: ...
- 【贪心】hdu6180 Schedule
题意:给你n个任务的开始时间和结束时间,一个机器同时最多执行一个任务,问你最少要几个机器.保证机器最少的前提下,问你每个机器的开动时间(最后一次关闭-第一次开启)之和最少是多少. 把这些线段画在数轴上 ...
- 【容斥原理】Codeforces Round #428 (Div. 2) D. Winter is here
给你一个序列,让你对于所有gcd不为1的子序列,计算它们的gcd*其元素个数之和. 设sum(i)为i的倍数的数的个数,可以通过容斥算出来. 具体看这个吧:http://blog.csdn.net/j ...
- 【找规律】【DFS】Gym - 101174H - Pascal's Hyper-Pyramids
二维下,如果把杨辉三角按照题目里要求的那样摆放,容易发现,第i行第j列的数(从0开始标号)是C(i+j,i)*C(j,j). 高维下也有类似规律,比如三维下,最后一层的数其实是C(i+j+k,i)*C ...
- python3-开发进阶补充Django中的文件的上传
PS:这段时间有点不在状态,刚刚找回那个状态,那么我们继续曾经的梦想 今天我们来补充一下文件的上传的几种方式: 首先我们先补充的一个知识点: 一.请求头ContentType: ContentType ...
- 重拾vue2
Vue组件 一.组件介绍 每一个组件都是一个vue实例 每个组件均具有自身的模板template,根组件的模板就是挂载点 每个组件模板只能拥有一个根标签 子组件的数据具有作用域,以达到组件的复用 二. ...
- [HDU1756]Cupid's Arrow
题目大意: 给你一个简单多边形和若干个点,问每个点在多边形内还是外. 思路: 一开始没看清楚题,写了一个叉积法,事实上叉积法只能用来处理凸多边形与点的关系. 考虑一个射线法. 从这个点水平往左作一条射 ...
- mormot日志
mormot日志 usesSynLog; if log = nil then // 日志 begin log := TSynLog.Add; log.Family.DestinationPath := ...