2 myselfnow myselfnow 于 2014.06.11 11:02 提问

asp.net中使用agsxmpp实现即时通讯,链接openfire,无法连接

asp.net中使用agsxmpp实现即时通讯,连接openfire,无法连接 。望有相关经验的大侠指点迷津,若哪位朋友能提供demo更是感激不尽了,在此先谢过了。下面是我改过的代码,改来改去都不行,感觉关键问题是xmpp_OnLogin方法事件中的编写。

  private XmppClientConnection xmpp=new XmppClientConnection();
    protected void Page_Load(object sender, EventArgs e)
    {
      //  Response.Write("<script type='text/javascript'>alert('OK');</script>");
        xmpp.OnLogin += new ObjectHandler(xmpp_OnLogin);
    //    xmpp.OnError += new ErrorHandler(xmpp_OnError);  
    }

    protected void cmdLogin_Click(object sender, EventArgs e)
    {
        //xmpp = (XmppClientConnection)Application["xmpp"];
        //if (xmpp == null)
        //{
        //    xmpp = new XmppClientConnection();
        //    Application["xmpp"] = xmpp;                
        //}

        xmpp.AutoPresence                        = true;
        xmpp.AutoResolveConnectServer   = true;
        xmpp.Port                                        = 5222;           
        xmpp.UseSSL                                   = false;
        xmpp.Server                                    = "example.com";
        xmpp.Username                             = "admin";
        xmpp.Password                              = "admin";
        xmpp.Priority = 10;
        xmpp.UseCompression = false;
        xmpp.EnableCapabilities = true;
        xmpp.ClientVersion = "1.0";
        xmpp.Resource = "WebClient";
        xmpp.Open();
      //  Response.Write("<script type='text/javascript'>alert('OK');</script>");
    }

    void xmpp_OnLogin(object sender)
    {
        Response.Write("<script type='text/javascript'>alert('OK');</script>");
    }
Csdn user default icon
上传中...
上传图片
插入图片