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>"); }
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!