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. ...
随机推荐
- php 获取指定月份的开始结束时间
/** * * 获取指定年月的开始和结束时间戳 * * @param int $y 年份 * @param int $m 月份 * @return array(开始时间,结束时间) */ functi ...
- 【转载】CoordinatorLayout源码解析
源码地址:https://github.com/desmond1121/AndroidSdkSourceAnalysis/blob/master/article/CoordinatorLayout%E ...
- hdu 5961 传递 (2016ccpc 合肥站 A题)
传递 Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submiss ...
- BZOJ 2888 资源运输(启发式合并LCT)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=2888 [题目大意] 不断加边,问每个连通块的重心到其它点的距离和的和 [题解] 启发式 ...
- 随机数选择器 Exercise07_13
import java.util.Scanner; /** * @author 冰樱梦 *时间:2018年下半年 *题目:随机数选择器 */ public class Exercise07_13 { ...
- android中自定义checkbox的图片和大小
其实很简单,分三步: 1.在drawable中创建文件checkbox_selector.xml: <?xml version="1.0" encoding="ut ...
- Linux系统/etc/sysconfig目录下没有iptables文件
在新安装的linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件. 解决办法: 1.键入以下命令,新建文件 2.复制以下 ...
- .Net 2014 Connect() 相关文章合集
微软在11月中旬的Connect()研讨会中公布了一系列 2015年的发展规划,今天在MSDN Blog上看到了一篇比较全的相关文章合集,这里转录一下,感兴趣的朋友可以看看. Announcement ...
- 模仿.Net ThreadPool的线程池控件
http://www.2ccc.com/btdown.asp?articleid=5953 ftp://download:S3cirpYW3DoR@www.2ccc.com/vcl/system/20 ...
- NHibernate 继承映射(第十六篇)
在NHibernate的映射中,关于继承的映射策略有3种方式 单表继承 类表继承 具体表继承 另外还有一种比较特别的多态映射 隐式多态 下面分别来阐述NHibernate继承映射的各种策略要点. 一. ...