XMPP TLS connection with SslStream

Posted by Marcom on Stack Overflow See other posts from Stack Overflow or by Marcom
Published on 2011-01-11T22:50:36Z Indexed on 2011/01/11 22:53 UTC
Read the original article Hit count: 627

Filed under:
|
|
|

I am trying to create a simple xmpp client that connects to Gtalk. The first part of the handshake seems to work. Ror the TLS handshake I created a client SslStream, connected to the intended server (talk.google.com) and successfully got authenticated .

The first SSlStream.Read is to receive the greeting reply, it went fine . I do a SslStream.write to send my first command, but when i do my Sslstream.Read() to get the reply , i get this error."System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine."

Can anyone point me to the right direction?

I am using code very similar to the example on msdn http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx except that I switch from a Network stream to a Sslstream when TLS is negotiated.

 netStream.Flush(); 
 sslStream = new SslStream(netStream,               
               true,
               new RemoteCertificateValidationCallback(ValidateServerCertificate),
               null
               );

  sslStream.AuthenticateAsClient("talk.google.com");

© Stack Overflow or respective owner

Related posts about c#

Related posts about xmpp