Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
julescoder #1
Member since Dec 2010 · 3 posts
Group memberships: Members
Show profile · Link to this post
Subject: Weird Auth Error (Client not sending <Auth>)
Hi,

I am new to the XMPP IM scene, but not new to the old REST API IM scene.

I was trying out agsxmpp to connect with the facebook chat server.
The client i created initiates to connect to the server.

Problem:
The problem is my client does not send the <auth> element specifying the auth mechanism.
In my packet sniffer, i get one jabber request packet, then two jabber response packets from the FB server, and then nothing at all..
My client does not send the <auth> element and nothing after that.
As a result i dont get the <challenge> element from the server.
And my code is similar to the MiniClient Sample.

My SocketRead:
SEND: <stream:stream to='chat.facebook.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="chat.facebook.com" version="1.0" xml:lang="en" id="87A20F02" >

RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-FACEBOOK-PLATFORM</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>

My Client Code :
            XmppClientConnection conn = new XmppClientConnection("chat.facebook.com", 5222);
            conn.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;
            conn.AutoAgents = true;
            conn.AutoRoster = true;

            conn.UseSSL = false;
            conn.UseStartTLS = false;
            conn.Priority = 10;
            conn.UseCompression = false;
            conn.AutoResolveConnectServer = true;
            conn.Resource = "JChat";
            conn.EnableCapabilities = true;
            conn.ClientVersion = "1.0";

            conn.Open("testuser", "testpass");
            conn.OnWriteXml += new XmlHandler(conn_OnWriteXml);
            conn.OnLogin += new ObjectHandler(conn_OnLogin);
            conn.OnAuthError += new XmppElementHandler(conn_OnAuthError);
            conn.OnReadSocketData += new agsXMPP.net.BaseSocket.OnSocketDataHandler(conn_OnReadSocketData);
            conn.OnReadXml += new XmlHandler(conn_OnReadXml);
            conn.OnSocketError += new ErrorHandler(conn_OnSocketError);

My Client Code

When i try it with the Mini Client example , its work perfectly.

Can anyone point out what i am missing ?
Thanx in advance !!
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
your code looks fine. Do you get one of the error handlers?
  • Have you referenced the correct dll?
  • Are you using the Desktop or Mobile version?

Alex
Avatar
julescoder #3
Member since Dec 2010 · 3 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex,

On your reply i implemented all the possible error handler.

And it happened so that the OnError event was fired, right after i receive the two above packets from the server.

The Exception Message was :
Unexpected end of file has occured. The following elements are not closed: stream:stream. Line 1, position 132

And I am using .NET 2.0 version of the dll for the desktop.
Avatar
Alex #4
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Is the problem fixed now or does it still occur?
It makes no sense that the same dll works fine in the MiniClient, but not your code.

Quote by julescoder:
The Exception Message was :
Unexpected end of file has occured. The following elements are not closed: stream:stream. Line 1, position 132

this exception is not from agsXMPP. So I guess some code in one of your handlers throws an manhandled exception which stops agsXMPP fro connecting.

Alex
Avatar
julescoder #5
Member since Dec 2010 · 3 posts
Group memberships: Members
Show profile · Link to this post
Ok, since you say this error is not from agsxmpp, i will have to dig into my code or create a new project altogether. I will update this thread if i get a solution.

Thanx for your replies.
Avatar
Alex #6
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Are you doing something with the Xml in the handlers OnReadXml and OnWriteXml? System.Xml throws such exceptions, but we don't use System.Xml at all.

Alex
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