我正在开发c#客户端以连接Openfire服务器
这是我的代码
User = txtUserName.Text;
Pwd = txtPassword.Text;
pnlCredentials.Enabled = false;
jabberClient1.User = User;
jabberClient1.Server = "61.182.225.189";
jabberClient1.Password = Pwd;
jabberClient1.AutoRoster = true;
jabberClient1.Port = 5222;
JID jid = new JID("kamal", "192,168,1,17", "123456");
jabberClient1.AutoLogin = true;
jabberClient1.Resource = jid.Resource;
jabberClient1.AutoStartTLS = true;
jabberClient1.NetworkHost = null;
jabberClient1.OnInvalidCertificate += new System.Net.Security.RemoteCertificateValidationCallback(jabberClient1_OnInvalidCertificate);
rm = new RosterManager();
rm.Stream = jabberClient1;
rm.AutoSubscribe = true;
rm.AutoAllow = jabber.client.AutoSubscriptionHanding.AllowAll;
rm.OnRosterBegin += new bedrock.ObjectHandler(rm_OnRosterBegin);
rm.OnRosterEnd += new bedrock.ObjectHandler(rm_OnRosterEnd);
rm.OnRosterItem += new RosterItemHandler(rm_OnRosterItem);
pm = new PresenceManager();
pm.Stream = jabberClient1;
rosterTree1.RosterManager = rm;
rosterTree1.PresenceManager = pm;
rosterTree1.DoubleClick += new EventHandler(rosterTree1_DoubleClick);
jabberClient1.OnAuthenticate += new bedrock.ObjectHandler(jabberClient1_OnAuthenticate);
lblUser.Text = jabberClient1.User;
jabberClient1.Connect();
我不确定我需要在下面的参数
中使用什么JID jid = new JID(“kamal”,“192,168,1,17”,“123456”);
我使用了用户名,服务器IP和密码
当我运行它时会返回错误
错误绑定资源错误类型=“修改”代码=“400”bad-requestmlns =“urn:ietf:params:xml:ns:xmpp-stanzas”
你能帮我解决一下吗?
提前谢谢
我已使用最新的Jabber.net DLL编辑代码
JabberClient jabberClient = new JabberClient();
//Bind the JabberClient events to methods that handle those events.
jabberClient.OnAuthError += new IQHandler(jabberClient_OnAuthError);
jabberClient.OnError += new bedrock.ExceptionHandler(jabberClient_OnError);
jabberClient.OnConnect += new bedrock.ObjectHandler(jabberClient_OnConnect);
jabberClient.OnDisconnect += new bedrock.ObjectHandler(jabberClient_OnDisconnect);
//Set client settings
jabberClient.AutoReconnect = 3;
JID jid = new JID("kamal", "192.168,1,17", "123456");
jabberClient.User = jid.User;
jabberClient.Server = jid.Server;
jabberClient.Port =5222;
jabberClient.Resource = jid.Resource;
jabberClient.Password = "123456";
jabberClient.AutoPresence = false;
jabberClient.AutoLogin = true;
jabberClient.Connect();
现在,当我尝试连接时,会发生火灾断开事件吗?