APNS APPLE C# sslstream 响应

发布于 2025-01-04 19:11:04 字数 600 浏览 0 评论 0原文

我想使用 Apple 的 APNS 和 ac# 服务。服务运行完美。 我想要的是苹果的反馈,如果我把平底锅寄给苹果的话。 所以我需要的是来自 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();

i want to use APNS from Apple with a c# service. The service runs perfect.
What i wanna have is the feedback from Apple if have send the pans to apple.
So what i need is the feedback from a sslstream.

Can anybody help me and tell me how i gat a feedback from the server within the sslstream ?

Thanks in advance

Here is my code how i send sthe pans to the apple server :

    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();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

灰色世界里的红玫瑰 2025-01-11 19:11:04

从这个苹果链接:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html

如果您发送通知并且 APNs 发现通知格式错误
否则无法理解,它会先返回一个错误响应数据包
断开连接。 (如果没有错误,APNs 不会返回
任何东西。)图 5-3 描述了错误响应的格式
数据包。

我假设您刚刚从流中读回,但我自己还没有开始工作。
我尝试发送格式错误的请求来响应数据包,但是我的读取调用被阻止,似乎在等待 ANPS 响应。

From this apple link:
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html

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.

I assume you just read back from the stream, however I haven't gotten this working yet myself.
I've attempted sending malformed requests in an effort to reponse packet, however my read call gets blocked, seemingly waiting for the ANPS to respond.

笙痞 2025-01-11 19:11:04

我从 APNS Sharp 获得了这些代码。

        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。我相信这些事件可能是您正在寻找的反馈。

I got these code from APNS Sharp.

        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"));
            }
        }

Where apnsStream is like you sslStream. I believe that those events could be the feedback that you are searching.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文