2

Apple の APNS を ac# サービスで使いたいです。サービスは完璧に動作します。私が欲しいのは、鍋をアップルに送った場合のアップルからのフィードバックです。だから私が必要としているのは、sslstream からのフィードバックです。

誰でも私を助けて、sslstream内のサーバーからフィードバックを得る方法を教えてもらえますか?

前もって感謝します

フライパンをAppleサーバーに送信するコードは次のとおりです。

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

2 に答える 2

0

このアップルのリンクから: http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html

通知を送信し、APNs が通知の形式が正しくないか、またはその他の理由で理解できないことを検出した場合、接続を切断する前にエラー応答パケットを返します。(エラーがない場合、APNs は何も返しません。) 図 5-3 は、エラー応答パケットの形式を示しています。

ストリームから読み返しただけだと思いますが、私自身はまだこれを機能させていません。パケットに応答するために不正な形式の要求を送信しようとしましたが、読み取り呼び出しがブロックされ、ANPS が応答するのを待っているようです。

于 2012-05-25T03:50:30.073 に答える
0

これらのコードは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のようなものです。これらのイベントは、あなたが探しているフィードバックになると思います。

于 2012-05-25T05:25:47.303 に答える