When I first started using agsXmpp, there was very little information on the Internet, and many of them were the same, all of which were modified here and there. Not at all for newbies who are just getting into this AgsXmpp. I also flipped through the information on the Internet for 2 days, referred to the SDK, and wrote a .net client to communicate with Spark.
1. I'm a rookie in .net, and I've written half of it, but I think the most important thing to pay attention to in .net is to clearly distinguish what is JID, what is XmppClientConnection, and the properties in it.
As if I declared a Jid j=new Jid("abc@server_name"); Behind @ is the name of your server, don't write your IP address, that will not pass the verification, unless you should use the source code in Openfire. If you want to specify the ip, you can use XmppClicentConnection.connectServer="xxxxxxxxx"; xxxx represents the IP address of your server.
2. After clearly understanding the first point, the second point is relatively simple. Connect to Openfire, set your login name, and the login password is OK;
XmppClientConnection con=new XmppClicentConnection();
con. Username="your user name";
con. Password="your pass word";
con.server="your server not ip addrs!!!!";
If these steps are correct, let's modify the connection authentication method, that MD-。。。 Whatever. No, it can only be passed with Plain.
To do it in con. OnSaslStart event.
You can change it to this:
args. Auto = false; args. Mechanism = agsXMPP.protocol.sasl.Mechanism.GetMechanismName(agsXMPP.protocol.sasl.MechanismType.PLAIN);
3. Then you can log in and verify afterwards. con.open;
Demo download, only the connection function is implemented:
OpenfireXMPP.rar
(228.89 KB, Number of downloads: 1, 售价: 3 粒MB)
|