我想将 Apple 的 APNS 与 c# 服务结合使用。该服务运行完美。 如果将平底锅发送给苹果,我想要的是苹果的反馈。 所以我需要的是来自 sslstream 的反馈。
任何人都可以帮助我并告诉我如何从 sslstream 中的服务器获得反馈吗?
提前致谢
这是我如何将平底锅发送到苹果服务器的代码:
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();
最佳答案
If you send a notification and APNs finds the notification malformed or otherwise unintelligible, it returns an error-response packet prior to disconnecting. (If there is no error, APNs doesn’t return anything.) Figure 5-3 depicts the format of the error-response packet.
我假设您刚刚从流中读回,但我自己还没有让它工作。 我试图发送格式错误的请求以响应数据包,但是我的读取调用被阻止,似乎在等待 ANPS 响应。
关于c# - APNS APPLE C# sslstream 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9223704/