openfire + qxmpp simple application

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/u012532263/article/details/83181596

1. Download and install openfire, openfire browser configuration, in accordance with the basic default settings are just fine.

Note: No special requirements are recommended to use the database, save time, I'm using mysql own database installation (do not use the latest version, connection problems, mysql5.7.x best).

 

2. Create two users on openfire:

3. Spark download and install software, test openfire server is configured correctly, open the Spark software, using the account you just created to sign openfire server:

The domain name is the server, first click Advanced Settings Interface -> Disable certificates hostname verification (not recommended) -> Check

If you can successfully sign in to explain openfire server environment configuration OK.

4. Download the compiled Qxmpp source, on github has, at the beginning I found it touches cmake to compile the source code, since my qt mingw version, I found a long time and finally found a source can be used, and I uploaded to the CSDN , Download: https://download.csdn.net/download/u012532263/10726891

Use qtcreator Open pro files are compiled: generates a corresponding dll file: qxmpp0.dll and qxmpp0_d.dll correspond debug and release versions

5. Use QXmpp protocol, create a project on the qt, add the corresponding libraries and header files on the pro file:

qxmpp the simplest connection openfire server code:

    // login openfire service
    QXmppClient xmppClient;
    xmppClient.configuration().setJid("[email protected]");
    xmppClient.configuration().setPassword("admin");
    xmppClient.connectToServer(m_xmppClient.configuration());

运行程序后,可以在openfire服务器上看见admin用户在线状态,说明成功了:

 

6. 基于qxmpp协议实现最简单的聊天客户端:

最简单的聊天客户端源码下载:https://download.csdn.net/download/u012532263/10732014
 

仅供学习参数,谢谢! by Dione

 

 

Guess you like

Origin blog.csdn.net/u012532263/article/details/83181596