Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
drkclw #1
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: Issue connecting to open fire server
I am new to XMPP and this library and I just started developing a very simple chat client using openfire as the server; I've been reading a lot of posts that seem to have the same issue as I do but for some reason I can't get it to work, below is my code:

//client.ConnectServer = "10.9.1.21";
            client.Server = "10.9.1.21";
            client.Open("sgomez","MyPassword");
           
            //client.AutoResolveConnectServer = false;
            //client.ConnectServer = "10.9.1.21";

            int i = 0;
            _wait = true;
            do
            {               
                i++;
                if (i == 10)
                    _wait = false;
                Thread.Sleep(2500);
            } while (_wait);

            Presence p = new Presence(ShowType.chat, "TESTING");
            p.Type = PresenceType.available;
            client.Send(p);

And this is the XML I'm getting:

WRITE: <stream:stream to='10.9.1.21' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
READ: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" id="a5b93fdb" version="1.0" from="inktel" >
READ: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /></stream:features>
WRITE: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
READ: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
WRITE: <stream:stream to='10.9.1.21' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
READ: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" id="a5b93fdb" version="1.0" from="inktel" >
READ: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /></stream:features>
WRITE: <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">XXX</auth>
READ: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
WRITE: <stream:stream to='10.9.1.21' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
READ: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" id="a5b93fdb" version="1.0" from="inktel" >
READ: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></stream:features>
WRITE: <iq id="agsXMPP_1" type="set" to="10.9.1.21"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>agsXMPP</resource></bind></iq>
READ: <iq xmlns="jabber:client" to="inktel/a5b93fdb" id="agsXMPP_1" type="error" from="10.9.1.21"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>agsXMPP</resource></bind><error type="modify" code="400"><bad-request xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
WRITE: <presence><show>chat</show><status>TESTING</status></presence>
READ: <presence xmlns="jabber:client" type="error" to="inktel/a5b93fdb"><show>chat</show><status>TESTING</status><error type="auth" code="401"><not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></presence>

I know that the "to" and "from" parameters must match but I haven't been able to set them properly even when I use the ConnectServer property. I've also tried the Matrix sample code below just as a test and it works:

xmppClient.SetUsername("sgomez");
            xmppClient.SetXmppDomain("10.9.1.21");
            xmppClient.Password = "MyPassword";

            xmppClient.Status = "I'm chatty";
            xmppClient.Show = Matrix.Xmpp.Show.chat;

            xmppClient.Open();

Any idea what am I missing in my agsXMPP code?
This post was edited 2 times, last on 2012-12-14, 13:24 by Alex.
Avatar
drkclw #2
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: Solution found
This issue has been solved.
Avatar
Alex #3
Member since Feb 2003 · 4328 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you server domain is inktel, not 10.9.1.21.

Alex
Avatar
drkclw #4
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Yes, I went into the OpenFire admin console and changed the domain, I got it to work, I was able to log in and get the presence of my contacts but it then stopped all of a sudden again, below is the latest XML:

WRITE: <stream:stream to='10.9.1.21' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
READ: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xml:lang="en" id="cf1e3f5e" version="1.0" from="10.9.1.21" >
READ: <stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /></stream:features>
WRITE: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
READ: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
Connection state: Securing
Authenticated? False
WRITE: <presence><show>chat</show><status>TESTING</status></presence>

I noticed the ANONYMOUS value inside the mechanism tag, could that be the problem? If so, what is the solution?

Thanks in advance
Avatar
drkclw #5
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Anonymous login was enabled on the server, I disabled it but the issue is still present
Avatar
Alex #6
Member since Feb 2003 · 4328 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You send a presence stanza before you are logged in. Wait until you are logged in and have received the roster.

Alex
Avatar
drkclw #7
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
I moved that piece of code to the handler of the OnLogin, however, I still find it weird that it was working and then it stopped all of a sudden, besides it seems my username can't get authenticated.
Avatar
Alex #8
Member since Feb 2003 · 4328 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you don't need this code at all, because agsXMPP and MatriX sends your presence automatically on successful login.
You also should use domains, it IP-addresses. XMPP is a domain based protocol like SMTP.

Alex
Avatar
drkclw #9
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Got it to work again, it was another configuration within openfire. Thanks.
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