【问题标题】:No response in AG-Softwate MatriXAG-Softwate MatriX 无响应
【发布时间】:2014-09-10 04:14:15
【问题描述】:

我正在通过 AG-Softwate MatriX 开发一个 IM,我想实现 login 操作,但是当我使用 xmppClient.open() 时,我 无法接收帮助我接受证书的 xml 流。

这是我在控制台中发送或接收或输出的 xml:

send:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="dodo.com" version="1.0" >
rec:<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="2543867956" from="dodo.com" version="1.0" xml:lang="en" >
'vivid.vshost.exe' (CLR v4.0.30319: vivid.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_zh-Hans_b77a5c561934e089\System.resources.dll'. Module was built without symbols.
rec:<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>DIGEST-MD5</mechanism>
    <mechanism>SCRAM-SHA-1</mechanism>
  </mechanisms>
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="k0acyvEdZQ7cl5uD5FTPoiOnuaw=" />
  <register xmlns="http://jabber.org/features/iq-register" />
</stream:features>
send:<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
rec:<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />

不知道为什么我的程序没有发送剩下的xml,你可以看到正确的xml流:

SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="dodo.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="3880372647" from="dodo.com" version="1.0" xml:lang="en" >
RECV: <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>DIGEST-MD5</mechanism>
    <mechanism>SCRAM-SHA-1</mechanism>
  </mechanisms>
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="k0acyvEdZQ7cl5uD5FTPoiOnuaw=" />
  <register xmlns="http://jabber.org/features/iq-register" />
</stream:features>
SEND: <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
RECV: <proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="dodo.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="2091441686" from="dodo.com" version="1.0" xml:lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
    <mechanism>PLAIN</mechanism>
    <mechanism>DIGEST-MD5</mechanism>
    <mechanism>SCRAM-SHA-1</mechanism>
  </mechanisms>
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="k0acyvEdZQ7cl5uD5FTPoiOnuaw=" />
  <register xmlns="http://jabber.org/features/iq-register" />
</stream:features>
SEND: <auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1pbWFjLHI9NmJkdG40NWdGbTNoYWJIR3JpdGdnOUdqT21yUDU0alA=</auth>
RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cj02YmR0bjQ1Z0ZtM2hhYkhHcml0Z2c5R2pPbXJQNTRqUGFqRWRPa0hKUGRCczl4aWMxN3lSeXc9PSxzPWowdHhSY0pnY0FaUkdYcnpCMUJydmc9PSxpPTQwOTY=</challenge>
SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9NmJkdG40NWdGbTNoYWJIR3JpdGdnOUdqT21yUDU0alBhakVkT2tISlBkQnM5eGljMTd5Unl3PT0scD0weDZXcFJ1WG0vQzF5a3JIUXA1c2lBS2lpbzA9</response>
RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dj1CRitFMkdhcVZLYlRVeHpLbWxwVG82YVpDZzQ9</success>
SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="dodo.com" version="1.0" >
RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" id="3562760347" from="dodo.com" version="1.0" xml:lang="en" >
RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" />
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
  <sm xmlns="urn:xmpp:sm:2" />
  <sm xmlns="urn:xmpp:sm:3" />
  <c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.process-one.net/en/ejabberd/" ver="k0acyvEdZQ7cl5uD5FTPoiOnuaw=" />
  <register xmlns="http://jabber.org/features/iq-register" />
</stream:features>
SEND: <iq id="MX_1" type="set" xmlns="jabber:client">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <resource>MatriX</resource>
  </bind>
</iq>
RECV: <iq id="MX_1" type="result" xmlns="jabber:client">
  <bind xmlns="urn:ietf:params:xml:ns:xmpp-bind">
    <jid>imac@dodo.com/MatriX</jid>
  </bind>
</iq>
SEND: <iq id="MX_2" type="set" xmlns="jabber:client">
  <session xmlns="urn:ietf:params:xml:ns:xmpp-session" />
</iq>
RECV: <iq type="result" id="MX_2" xmlns="jabber:client" />
SEND: <iq id="MX_3" type="get" xmlns="jabber:client">
  <query xmlns="jabber:iq:roster" />
</iq>
RECV: <iq from="imac@dodo.com" to="imac@dodo.com/MatriX" id="MX_3" type="result" xmlns="jabber:client">
  <query xmlns="jabber:iq:roster">
    <item subscription="both" jid="test2@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="123456@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="macbook@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="123457@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="test3@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="admin@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="test4@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="yj@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="test@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="yuanjiong@dodo.com">
      <group>EveryBody</group>
    </item>
    <item subscription="both" jid="taojiaen@dodo.com" />
    <item ask="subscribe" subscription="none" jid="taojiaen@163.com" />
  </query>
</iq>
SEND: <presence xmlns="jabber:client">
  <status></status>
  <priority>0</priority>
</presence>
RECV: <presence from="imac@dodo.com/MatriX" to="imac@dodo.com/MatriX" xmlns="jabber:client">
  <status />
  <priority>0</priority>
</presence>

如您所见,我丢失了很多流,因为我的程序没有发送正确的 xml 请帮我找出错误。

这是我的代码

        Config.NowXmppClient = new XmppClient();
        Config.NowXmppClient.ResolveSrvRecords = false;
        Config.NowXmppClient.SetXmppDomain("dodo.com");
        Config.NowXmppClient.Hostname = "123.456.789s.130";
        Config.NowXmppClient.Port= 5222;
const string LIC = @"eJxkkN1SgzAQhV+l470GHLXF2WZEpS2lYv+o08sIMUITAiGxwNPb2vp/s7O7
357dMwuTNKZ5RTu14HnVPyHstJIveksUveYHdIJhqmRiYu0neKFNkkpA3x2Y
GZLrVDfYBvSVw52ptBRUYQiJoNh7I9wQLRWgjxrupChI3nyCVOadoxVAnww8
QVKOK8JpdfPD2VmyGzqw3fDXoahIiKZeXaSK3u8yfG7Zl5ZjOYD+IfCreyok
1srsdh0L2Mff+gvb2uv/AFikLCfaKIq35cOwPb/yeMzasW8PMgcNuugqKpdW
MvBcq5mVt2vCellMrWw+Cdcuvy2WZIOcyaj2h342DcLQsdeBiJpX/mAHw17j
luEsImbKFs9hN2rV8Ok1HhdSsMA1o27LWW81mjxS/+V5U69UvSAoq5mTuyNn
Gyg2d8vHplHzrvZNQthyI9SgzcdP2z6gb9+A7wI=";
       Matrix.License.LicenseManager.SetLicense(LIC);

       Config.NowXmppClient.OnReceiveXml += new System.EventHandler<Matrix.TextEventArgs>(this.xmppClient_OnReceiveXml);
       Config.NowXmppClient.OnSendXml += new System.EventHandler<Matrix.TextEventArgs>(this.xmppClient_OnSendXml);
            //Config.NowXmppClient.OnStreamError += new System.EventHandler<Matrix.StreamErrorEventArgs>(this.xmppClient_OnStreamError);
       Config.NowXmppClient.OnValidateCertificate += new System.EventHandler<Matrix.CertificateEventArgs>(this.xmppClient_OnValidateCertificate);
       Config.NowXmppClient.OnLogin += new System.EventHandler<Matrix.EventArgs>(this.xmppClient_OnLogin);

    private void xmppClient_OnValidateCertificate(object sender, CertificateEventArgs e)
    {
        // always accept cert
        e.AcceptCertificate = true;
        StackFrame[] stacks = new StackTrace().GetFrames();
        Console.Write(ToString(stacks));

        // or let the user validate the certificate
        // ValidateCertificate(e);
    }

    private void xmppClient_OnLogin(object sender, Matrix.EventArgs e)
    {
        Console.WriteLine("OnLogin");
    }

    private void xmppClient_OnReceiveXml(object sender, TextEventArgs e)
    {
        Console.WriteLine("rec:" + e.Text);
    }


    private void xmppClient_OnSendXml(object sender, TextEventArgs e)
    {
        Console.WriteLine("send:" + e.Text);
    }

谁来帮忙!

【问题讨论】:

    标签: c# wpf matrix xmpp


    【解决方案1】:

    您的 TLS 服务器证书似乎有问题。 尝试安装正确的服务器证书或尝试不使用 TLS 进行连接

    Config.NowXmppClient.StartTls = false;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      • 2021-11-25
      • 2020-06-12
      • 2019-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多