【发布时间】:2011-01-11 22:50:36
【问题描述】:
我正在尝试创建一个连接到 Gtalk 的简单 xmpp 客户端。 握手的第一部分似乎有效。 Ror TLS 握手我创建了一个客户端 SslStream,连接到预期的服务器 (talk.google.com) 并成功通过身份验证。
第一个 SSlStream.Read 是接收问候回复,一切顺利。我执行 SslStream.write 来发送我的第一个命令,但是当我执行 Sslstream.Read() 来获取回复时,我收到此错误。“System.IO.IOException: Unable to read data from the transport connection: An installed连接已被主机中的软件中止。”
谁能指出我正确的方向?
我使用的代码与 msdn http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx 上的示例非常相似 除了在协商 TLS 时我从网络流切换到 Sslstream。
netStream.Flush();
sslStream = new SslStream(netStream,
true,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
null
);
sslStream.AuthenticateAsClient("talk.google.com");
【问题讨论】: