我想使用来自苹果的APNS和c#服务。服务运行得很好。我想要的是苹果的反馈,如果已经把平底锅送到苹果的话。所以我需要的是来自sslstream的反馈。
有人能帮助我并告诉我如何在sslstream中获取来自服务器的反馈信息吗?
提前感谢
下面是我将pans发送到苹果服务器的代码:
TcpClient client = new TcpClient(hostname, APNS_PORT);
SslStream sslStream = new SslStream(
client.GetStream(),
false,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
null
);
sslStream.AuthenticateAsClient(hostname, certificatesCollection, SslProtocols.Tls, true);
sslStream.Write(array);
sslStream.Flush();发布于 2012-05-25 03:50:30
从这个苹果链接:http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html
如果您发送一个通知,并且an发现该通知格式错误或其他无法理解,它将在断开连接之前返回一个错误响应数据包。(如果没有错误,则APN不会返回任何内容。)图5-3描述了错误响应包的格式.
我想你刚刚从溪流中读回来,但是我自己还没有开始工作。我试图发送格式错误的请求以响应数据包,但是我的读取呼叫被阻止,似乎在等待ANPS响应。
发布于 2012-05-25 05:25:47
我从APNS夏普得到了这些代码。
if (!this.apnsStream.IsMutuallyAuthenticated)
{
if (this.Error != null)
{
this.Error(this, new NotificationException(4, "Ssl Stream Failed to Authenticate"));
}
}
if (!this.apnsStream.CanWrite)
{
if (this.Error != null)
{
this.Error(this, new NotificationException(5, "Ssl Stream is not Writable"));
}
}apnsStream就像你sslStream。我相信,这些事件可能是你正在寻找的反馈。
https://stackoverflow.com/questions/9223704
复制相似问题