Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
sny2k8 #1
User title: NS
Member since Dec 2008 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: WM 6.0: Getting an exception in crypto.dll
I am writing a test XMPP client for wm6.0 to talk to Gmail. I downloaded the latest SDK and copied the two dlls (agsxmpp.dll and crypto.dll) from the <AGSXMPPSDK>\agsxmpp\bin\CF2\Release directory to the project and did the usual VS stuff. When I run the client in emulator, I get an exception that I have no idea what I should/can do.

Thanks for your help.

Output leading upto the exception
IPV4
Waiting...
ClientSocket_OnSend
<stream:stream to='gmail.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
ClientSocket_OnReceive
<?xml version="1.0" encoding="UTF-8"?><stream:stream from="gmail.com" id="9E0F7E9D6A02CC5E" version="1.0" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">
The thread 0x565f12ea has exited with code 0 (0x0).
ClientSocket_OnSend
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
ClientSocket_OnReceive
<stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
ClientSocket_OnSend
<presence><status /><priority>5</priority></presence>
ClientSocket_OnSend
<stream:stream to='gmail.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
ClientSocket_OnReceive
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechani
ClientSocket_OnSend
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
ClientSocket_OnReceive
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>xml:ns:xmpp-tls"><required/></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></mechanisms></stream:features>
OnError
A first chance exception of type 'System.IO.EndOfStreamException' occurred in crypto.dll
at Org.BouncyCastle.Crypto.Tls.TlsUtilities.ReadUint8()
at Org.BouncyCastle.Crypto.Tls.RecordStream.ReadData()
at Org.BouncyCastle.Crypto.Tls.TlsProtocolHandler.Connect()
at agsXMPP.net.ClientSocket.StartTls()
at agsXMPP.XmppClientConnection.StreamParserOnStreamElement()
at agsXMPP.Xml.StreamParser.DoRaiseOnStreamElement()
at agsXMPP.Xml.StreamParser.EndTag()
at agsXMPP.Xml.StreamParser.Push()
at agsXMPP.XmppConnection.SocketOnReceive()
at agsXMPP.net.BaseSocket.FireOnReceive()
at agsXMPP.net.ClientSocket.EndReceive()
at System.Net.LazyAsyncResult.InvokeCallback()
at WorkerThread.doWork()
at WorkerThread.doWorkI()
at WorkItem.doWork()
at System.Threading.Timer.ring()
---

Here is the full code..

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using agsXMPP;
using agsXMPP.protocol;
using agsXMPP.protocol.iq;
using agsXMPP.protocol.iq.disco;
using agsXMPP.protocol.iq.roster;
using agsXMPP.protocol.iq.version;
using agsXMPP.protocol.client;
using agsXMPP.protocol.extensions.shim;

using agsXMPP.protocol.x;
using agsXMPP.protocol.x.data;

using agsXMPP.Xml;
using agsXMPP.Xml.Dom;

using System.Threading;
using System.Diagnostics;

namespace JabberTestCF2
{
    public partial class Form1 : Form
    {
        private XmppClientConnection XmppCon;
        private string txtJid = "xyz@gmail.com";
        private string txtPassword = "abc";

        public Form1()
        {
            InitializeComponent();
        }

        public void MainInit()
        {
            JabberInit();
            Connect();
        }

        private void Connect()
        {
            Jid jid = new Jid(txtJid);
            XmppCon.Open(jid.User, txtPassword);
        }

        private void Disconnect()
        {
            XmppCon.Close();
        }
       
        private void JabberInit()
        {
            // initilaize XmppConnection and setup all event handlers
            Jid jidSender = new Jid(txtJid);
            XmppCon = new XmppClientConnection(jidSender.Server);
            if (jidSender.Server == "gmail.com")
            {
                XmppCon.ConnectServer = "talk.google.com";
            }
            XmppCon.AutoResolveConnectServer = false;

            XmppCon.OnError += new ErrorHandler(XmppCon_OnError);
            XmppCon.OnAuthError += new XmppElementHandler(XmppCon_OnAuthError);
            XmppCon.OnPresence += new PresenceHandler(XmppCon_OnPresence);
            XmppCon.OnMessage += new MessageHandler(XmppCon_OnMessage);

            XmppCon.ClientSocket.OnReceive += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnReceive);
            XmppCon.ClientSocket.OnSend += new agsXMPP.net.ClientSocket.OnSocketDataHandler(ClientSocket_OnSend);

        }

        #region << XmppConnection events >>

        private void XmppCon_OnPresence(object sender, Presence pres)
        {
#if DEBUG
            Debug.WriteLine(String.Format("Received Presence from:{0} show:{1} status:{2}", pres.From.ToString(), pres.Show.ToString(), pres.Status));
#endif
        }

        private void XmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
#if DEBUG
            Debug.WriteLine(String.Format("OnMessage from:{0} type:{1}", msg.From.Bare, msg.Type.ToString()));
            Debug.WriteLine(msg.Body);
#endif
        }

        private void XmppCon_OnClose(object sender)
        {
#if DEBUG
            Debug.WriteLine("OnClose");
#endif
        }

        private void XmppCon_OnError(object sender, Exception ex)
        {
#if DEBUG
            Debug.WriteLine("OnError");
            Debug.WriteLine(ex.StackTrace.ToString());
#endif
        }

        void XmppCon_OnAuthError(object sender, agsXMPP.Xml.Dom.Element e)
        {
#if DEBUG
            Debug.WriteLine("OnAuthError");
            Debug.WriteLine(e.ToString());
#endif
        }
        #endregion
       
        private bool ClientSocket_OnValidateCertificate(Org.BouncyCastle.Asn1.X509.X509CertificateStructure[] certificates)//, int[] certificateErrors)
        {
            return true;
        }
       

        private void ClientSocket_OnReceive(object sender, byte[] data, int count)
        {
#if DEBUG
            Debug.WriteLine("ClientSocket_OnReceive");
            Debug.WriteLine(System.Text.Encoding.Default.GetString(data, 0, count));
#endif
        }

        private void ClientSocket_OnSend(object sender, byte[] data, int count)
        {
#if DEBUG
            Debug.WriteLine("ClientSocket_OnSend");
            Debug.WriteLine(System.Text.Encoding.Default.GetString(data, 0, count));
#endif
        }
   }
}
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please try with
Quote by cpp:
XmppCon.UseStartTls = false;

I will try to debug the crypto dll with Google talk and see whats going on there. One some other XMPP mailing lists issues with Google Talk's Tls implementation were reported as well. See also here: http://metajack.im/2008/11/17/tls-issues-with-google-talk/

Can you please also try some other public servers like jabber.org with TLS?

Alex
This post was edited on 2008-12-12, 07:48 by Alex.
Avatar
sny2k8 #3
User title: NS
Member since Dec 2008 · 2 posts
Group memberships: Members
Show profile · Link to this post
I guess you mean "XmppCon.useStartTLS=false" (couldn't find useTLS property there). I tried that and that fails to get that far even. I would give jabber.org a try but they don't run gtalk transport so it wouldn't really help me to connect to gtalk users. Do you have any other public server that I can try without needing TLS and supports gtalk transport.

Thanks for your help.
Avatar
Alex #4
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
sorry I meant UseStartTls. Please send you Xml Debug if it doesnt work with UseStartTls = false.
Why do you need a Gtalk transport? You can communicate with every federated XMPP server to Google Talk users.
Avatar
msathya03 #5
Member since Mar 2009 · 12 posts
Group memberships: Members
Show profile · Link to this post
HI ,

    I too get a same error.
A first chance exception of type 'System.IO.EndOfStreamException' occurred in crypto.dll
A first chance exception of type 'System.IO.IOException' occurred in crypto.dll

Could u pls help me how to solve this issue.

Thanks
M.Sathya.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS