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">AHNnb21legBDb2dpdG8zcmcwc3Vt</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?
//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">AHNnb21legBDb2dpdG8zcmcwc3Vt</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?
drkclw
Show profile
Link to this post
