アプリケーションで Apache Thrift を使用して、複数のマシン間でデータを交換しています。
outspace からデータを受け取り、トランスポート、プロトコルを作成し、受け取ったデータをオブジェクトにデシリアライズします。これが私のコードです:
using (var memoryStream = new MemoryStream(data))
{
using (var transport = new TStreamTransport(memoryStream, memoryStream))
{
transport.Open();
using (var protocolo = new TBinaryProtocol(transport))
{
var result = new TCciUserLoginV1.cciUserLoginV1_result();
while (result.Success== null)
{
try
{
result.Read(protocolo);
}
catch { }
}
if (result.Success != null)
{
res = new RequestResult(result.Success);
}
else
{
res = new RequestResult(ResultCodes.LOCAL_ERROR");
}
}
}
}
他のタイプの逆シリアル化は例外をスローするため、バイナリシリアル化されたTCciUserLoginV1.cciUserLoginV1_resultを受け取ります。ただし、 result.Successプロパティの通常の逆シリアル化は、while サイクルの 10 回目の反復後にのみ発生します。whileを使用した理由は何ですか。誰が何が起こっているのか教えてもらえますか?
前もって感謝します。