Not logged in. · Lost password · Register
Forum: MatriX RSS
Avatar
jackchen #1
Member since Oct 2013 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Unable to send data. The XMPP Stream is inactive
  my code    
  1. XmppClient xmppClient = new XmppClient();
  2.         protected void btnLogin_Click(object sender, EventArgs e)
  3.         {
  4.             xmppClient.SetUsername("csx");
  5.             xmppClient.SetXmppDomain(SERVER_NAME);
  6.             xmppClient.Hostname = SERVER_HOST;
  7.             xmppClient.Password = "111111";
  8.             xmppClient.Port = SERVER_PORT;
  9.             xmppClient.StartTls = false;
  10.             xmppClient.Show = Matrix.Xmpp.Show.chat;
  11.             //xmppClient.OnRosterEnd += delegate
  12.             //{
  13.             //    xmppClient.Send(new Message
  14.             //    {
  15.             //        To = "samuel@yorkbbs/Spark 2.6.3",
  16.             //        Type = MessageType.chat,
  17.             //        Body = "Hello World"
  18.             //    });
  19.  
  20.             //};//this is ok,i can get the msg
  21.             xmppClient.Open();
  22.  
  23.         }
  24.  
  25.         protected void btnSend_Click(object sender, EventArgs e)
  26.         {
  27.            
  28.             var msg = new Message {
  29.                     Type=MessageType.chat,
  30.                     To="samuel@yorkbbs/Spark 2.6.3",
  31.                     Body=this.TextBox1.Text
  32.             };
  33.             xmppClient.Send(msg);//error
  34.         }


  1. 10:04:48.77 SOCKET SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="yorkbbs" version="1.0" >
  2.  10:04:48.78 SOCKET RECV: <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="yorkbbs" id="413adad5" xml:lang="en" version="1.0">
  3.  10:04:48.98 SOCKET RECV: <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
  4.  10:04:49.07 SOCKET SEND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
  5.  10:04:49.09 SOCKET RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InlvcmtiYnMiLG5vbmNlPSJRRDBsWjZ1bFE2ci96dXQrVGZibWlXYnlzRCt6enVLeDIwS0REOEtEIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
  6.  10:04:49.24 SOCKET SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImNzeCIscmVhbG09InlvcmtiYnMiLG5vbmNlPSJRRDBsWjZ1bFE2ci96dXQrVGZibWlXYnlzRCt6enVLeDIwS0REOEtEIixjbm9uY2U9IjU1Mzc2YWM0ZGFiZTg0ODEwYThkZDUwMTQ0N2E5NmZhNTMxODVmOWQ3ODg1Y2Q1MWY2YWFlMDU2YzNiYmE4NTUiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAveW9ya2JicyIsY2hhcnNldD11dGYtOCxyZXNwb25zZT1iYzJlOTlmNWJiZTY3MDg2MjhkMjU4ZDBlYTU4MzBiYQ==</response>
  7.  10:04:49.28 SOCKET RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cnNwYXV0aD1mOWFiODA0ZDA2YzQxNDUxZjdiOTY4ODgzMDBjZDk0OQ==</success>
  8.  10:04:49.29 SOCKET SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="yorkbbs" version="1.0" >
  9.  10:04:49.29 SOCKET RECV: <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="yorkbbs" id="413adad5" xml:lang="en" version="1.0"><stream:features><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>
  10.  10:04:49.32 SOCKET SEND: <iq id="MX_1" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>MatriX</resource></bind></iq>
  11.  10:04:49.32 SOCKET RECV: <iq type="result" id="MX_1" to="yorkbbs/413adad5"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><jid>csx@yorkbbs/MatriX</jid></bind></iq>
  12.  10:04:49.35 BindResult
  13.  10:04:49.35 sessionHack=True
  14.  10:04:49.35 SOCKET SEND: <iq id="MX_2" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session" /></iq>
  15.  10:04:49.36 SOCKET RECV: <iq type="result" id="MX_2" to="csx@yorkbbs/MatriX"/>
  16.  10:04:49.36 SOCKET SEND: <iq id="MX_3" type="get"><query xmlns="jabber:iq:roster" /></iq>
  17.  10:04:49.51 SOCKET RECV: <iq type="result" id="MX_3" to="csx@yorkbbs/MatriX"><query xmlns="jabber:iq:roster"><item jid="samuel@yorkbbs" name="samuel" subscription="both"><group>Friends</group></item></query></iq>
  18.  10:04:49.51 SOCKET SEND: <presence><show>chat</show><status></status><priority>0</priority></presence>
  19.  10:05:20.51 FireOnError: Matrix.XmppStreamException: Unable to send data. The XMPP Stream is inactive




what's the problem?please help me
This post was edited on 2013-10-21, 10:06 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4295 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I have no idea whats going on. When you send the message you are disconnected from the server which causes this error. So there must be something in your codes which causes a connection drop.

Have you tried the MiniClient example which comes with the download?
Avatar
jackchen #3
Member since Oct 2013 · 2 posts
Group memberships: Members
Show profile · Link to this post
i fix that,but i don't know the reason,i changed the code
  1. private static readonly Dictionary<string, XmppClient> XmppClients = new Dictionary<string, XmppClient>();
  2. protected void btnLogin_Click(object sender, EventArgs e)
  3.         {
  4.  
  5.             var xmppClient = new XmppClient();
  6.             xmppClient.SetUsername("csx");
  7.             xmppClient.SetXmppDomain(SERVER_NAME);
  8.             xmppClient.Hostname = SERVER_HOST;
  9.             xmppClient.Password = "111111";
  10.             xmppClient.Port = SERVER_PORT;
  11.             xmppClient.StartTls = false;
  12.             xmppClient.Show = Matrix.Xmpp.Show.chat;
  13.  
  14.             xmppClient.Open();
  15.             XmppClients.Add("1111111", xmppClient);
  16.         }
  17.  
  18.         protected void btnSend_Click(object sender, EventArgs e)
  19.         {
  20.             XmppClient xmppClient = XmppClients["1111111"];
  21.             var msg = new Message
  22.             {
  23.                 Type = MessageType.chat,
  24.                 To = "samuel@yorkbbs/Spark 2.6.3",
  25.                 Body = this.TextBox1.Text
  26.             };
  27.             xmppClient.Send(msg);
  28.         }
This post was edited on 2013-10-21, 11:52 by 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: MatriX RSS