Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
52xx #1
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
Subject: the problem of register
this is my code for register, but i cannot do it ,here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using agsXMPP.Collections;
using agsXMPP.protocol;
using agsXMPP;
using agsXMPP.Xml;
using agsXMPP.protocol.iq;
using agsXMPP.protocol.iq.roster;
using agsXMPP.protocol.iq.agent;
using agsXMPP.Xml.DomParser;

namespace agsxmpp_test
{
    public partial class Registerss : Form
    {
        private XmppClientConnection laji;

        public Registerss()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                agsXMPP.protocol.iq.register.Register reg = new agsXMPP.protocol.iq.register.Register(textBox1.Text, textBox2.Text);
                laji.Send(reg);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
            }
        }


        private void laji_OnLogin(object sender)
        {

            txtDebug.Text += "we are logged in to the server now" + System.Environment.NewLine;
            MessageBox.Show("we are logged in to the server now" + System.Environment.NewLine);
            txtDebug.Text += "set presence" + System.Environment.NewLine;
            txtDebug.SelectionStart = txtDebug.Text.Length;
            txtDebug.ScrollToCaret();
            laji.SendMyPresence();
        }

        private void laji_OnError(object sender, Exception ex)
        {
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
        }

        private void laji_OnReadXml(object sender, string xml)
        {
            txtDebug.Text += "RECV XML: " + xml + System.Environment.NewLine;
            txtDebug.SelectionStart = txtDebug.Text.Length;
            txtDebug.ScrollToCaret();
        }

        private void laji_OnWriteXml(object sender, string xml)
        {
            txtDebug.Text += "SEND XML: " + xml + System.Environment.NewLine;
            txtDebug.SelectionStart = txtDebug.Text.Length;
            txtDebug.ScrollToCaret();
        }

        private void laji_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            txtDebug.Text += msg.Body.ToString() + "\r\n";
        }

        private void laji_OnRegistered(object sender)
        {
            txtDebug.Text += "register ok !"+"\r\n";
            MessageBox.Show("register ok !");
        }

        private void Registerss_Load(object sender, EventArgs e)
        {
            laji = new XmppClientConnection();
            laji.OnReadXml += new XmlHandler(laji_OnReadXml);
            laji.OnWriteXml += new XmlHandler(laji_OnWriteXml);
            laji.OnLogin += new ObjectHandler(laji_OnLogin);
            laji.OnMessage += new XmppClientConnection.MessageHandler(laji_OnMessage);
            laji.OnError += new ErrorHandler(laji_OnError);
            laji.OnRegistered += new ObjectHandler(laji_OnRegistered);
            laji.RegisterAccount = true;
            laji.Server = "192.168.1.106";
            laji.Port =5222;
            laji.Open();

            try
            {
                txtDebug.Text += "open success !" + "\r\n";
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }

    }
}

and here is my debug message:
version='1.0'>
open success !
RECV XML: <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; from=&quot;192.168.1.101&quot; id=&quot;d994741e&quot; lang=&quot;en&quot; >
SEND XML: <iq xmlns=&quot;jabber:client&quot; id=&quot;agsXMPP_1&quot; type=&quot;set&quot; to=&quot;192.168.1.106&quot;><query xmlns=&quot;jabber:iq:register&quot;><username /><password /></query></iq>
RECV XML: <iq xmlns=&quot;jabber:client&quot; type=&quot;error&quot; id=&quot;agsXMPP_1&quot; from=&quot;192.168.1.106&quot; to=&quot;192.168.1.101/d994741e&quot;><query xmlns=&quot;jabber:iq:register&quot;><username /><password /></query><error code=&quot;406&quot; type=&quot;modify&quot;><not-acceptable xmlns=&quot;urn:ietf:params:xml:ns:xmpp-stanzas&quot; /></error></iq>
SEND XML: <query xmlns=&quot;jabber:iq:register&quot;><username>bbb</username><password>bbb</password></query>
RECV XML: </stream:stream>

hope for the anwser.
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi,

It looks like your server doesnt support in band registration.
Did you turn it on in the server configuration?
Which server are you using?

Alex
Alexander Gnauck
AG-Software
Avatar
52xx #3
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
the server is my localserver powered by jivemessager.
can you give me a simple example to register ?
i think i will know it sooner.
Avatar
52xx #4
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
the follow is my debug message by connection to the server "jabber.com.cn"

SEND XML: <stream:stream to='jabber.com.cn' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
open success !
SEND XML: <query xmlns=&quot;jabber:iq:register&quot;><username>cccccc</username><password>cccccc</password></query>
RECV XML: <stream:stream xmlns:stream=&quot;http://etherx.jabber.org/streams&quot; id=&quot;4320E07D&quot; from=&quot;jabber.com.cn&quot; >
SEND XML: <iq xmlns=&quot;jabber:client&quot; id=&quot;agsXMPP_1&quot; type=&quot;set&quot; to=&quot;jabber.com.cn&quot;><query xmlns=&quot;jabber:iq:register&quot;><username /><password /></query></iq>
RECV XML: <iq xmlns=&quot;jabber:client&quot; id=&quot;agsXMPP_1&quot; type=&quot;error&quot;><query xmlns=&quot;jabber:iq:register&quot;><username /><password /></query><error code=&quot;406&quot;>Not Acceptable</error></iq>
could you help me to manage the register problem?
thank you first  !
Avatar
52xx #5
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
and i really wanna an introduce to the agsXMPP class .Not only the  tectonic function,but also the introduction.

where can i get it  ?
Avatar
Alex #6
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi,

here is the debug from my Jive server on jabber.ag-software.de

SEND: <stream:stream to='jabber.ag-software.de' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="jabber.ag-software.de" id="ad8bcffb" lang="en" >
SEND: <iq xmlns="jabber:client" id="agsXMPP_1" type="set" to="jabber.ag-software.de"><query xmlns="jabber:iq:register"><username>test</username><password>test</password></query></iq>
RECV: <iq xmlns="jabber:client" type="result" id="agsXMPP_1" from="jabber.ag-software.de" to="jabber.ag-software.de/ad8bcffb" />
SEND: <iq xmlns="jabber:client" id="agsXMPP_2" type="get" to="jabber.ag-software.de"><query xmlns="jabber:iq:auth"><username>test</username></query></iq>
RECV: <iq xmlns="jabber:client" type="result" id="agsXMPP_2" from="jabber.ag-software.de"><query xmlns="jabber:iq:auth"><username>test</username><password /><digest /><resource /></query></iq>
SEND: <iq xmlns="jabber:client" id="agsXMPP_3" to="jabber.ag-software.de" type="set"><query xmlns="jabber:iq:auth"><username>test</username><digest>58e766f2b32db230b120e5db1d7b1d385026ca7c</digest><resource>MiniClient</resource></query></iq>
RECV: <iq xmlns="jabber:client" type="result" id="agsXMPP_3" from="jabber.ag-software.de" to="test@jabber.ag-software.de/MiniClient" />
SEND: <iq xmlns="jabber:client" id="agsXMPP_4" type="get" to="jabber.ag-software.de"><query xmlns="jabber:iq:agents" /></iq>
SEND: <iq xmlns="jabber:client" id="agsXMPP_5" type="get"><query xmlns="jabber:iq:roster" /></iq>
RECV: <iq xmlns="jabber:client" type="error" id="agsXMPP_4" from="jabber.ag-software.de" to="test@jabber.ag-software.de/MiniClient"><query xmlns="jabber:iq:agents" /><error code="501" type="cancel"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" /></error></iq>
RECV: <iq xmlns="jabber:client" type="result" id="agsXMPP_5" to="test@jabber.ag-software.de/MiniClient"><query xmlns="jabber:iq:roster" /></iq>
SEND: <presence xmlns="jabber:client"><status /><priority>10</priority></presence>

Do you press the button1 in your code? You dont need this. The lib is sending the register packet automatically when the RegisterAccount Property is set to true.

Alex
Alexander Gnauck
AG-Software
Avatar
Alex #7
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by "52xx":
and i really wanna an introduce to the agsXMPP class .Not only the  tectonic function,but also the introduction.

where can i get it  ?

what kind of intruduction you need? I wanna write a small document about the software design of this library, and the supported xmpp protocols.

Alex
Alexander Gnauck
AG-Software
Avatar
52xx #8
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
i think you misunderstand me. i can connect to the jabber server, only cannot to register.

i want to know how to use the lib ,not only the now document from the url
http://www.ag-software.net/content/agsxmpp/doc/index.html
Avatar
52xx #9
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
i must be involving a infinite loop.

should i have open the XmppClientConnection,then i set the propority(RegisterAccount)= true.now i success ?

another: i set the propority(RegisterAccount)= true,then open the XmppClientConnection. i can get the goal to register a new count after that ?

help me , now i really faint for that  !
Avatar
52xx #10
Member since Sep 2005 · 20 posts
Group memberships: Members
Show profile · Link to this post
ok,i've manged to register.
thank you for all your help ,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 SDK Support RSS