Can't connect to any server with QXmpp
-
I want to write a windows client to connect to an Openfire server. I'm using qxmpp library and c++ in Qt creator. Firstly I've tried to write simple app to find out if it connects to server. But it doesn't and I don't know why
I tried to connect my openfire server and some public xmpp servers, couldn't connect both. (I've tried to connect the server via Spark and Kaidan client and it worked).There is no information that there is any error, only what I know is that my client is not connecting to the server. Its like "11:10:25 2019 INFO Connecting to 127.0.0.1:5222" and nothing more. Is there any way to check why my client is not connecting? Maybe here is somone who can help
My .pro file inculudes those
QT += core gui QT += network xml QT += widgets INCLUDEPATH += C:\qxmpp\include\qxmpp LIBS += -L"C:\qxmpp\lib" -l:libqxmpp.dll \
that is my mainwindow.cpp
#include "mainwindow.h" #include <ui_mainwindow.h> #include <QXmppClient.h> #include <QXmppLogger.h> #include <QXmppPresence.h> #include <QDebug> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { QXmppClient client; QXmppConfiguration config; //config.setHost("localhost"); config.setHost("127.0.0.1"); //config.setHost("192.168.1.1"); //config.setJid("adminu@dismail.de"); config.setDomain("umut"); config.setPort(5222); config.setUser("admin"); config.setPassword("admin"); // qDebug() << "jid" << config.jid() << "jid"; // qDebug() << "user" << config.user() << "user"; // qDebug() << "pw" << config.password() << "pw"; // qDebug() << "port" << config.port() << "port"; // qDebug() << "host" << config.host() << "host"; if( client.isConnected()) qDebug() << "#######Connected to server#######"; client.logger()->setLoggingType(QXmppLogger::StdoutLogging); QXmppPresence pres; pres.setType(QXmppPresence::Available); //client.connectToServer("ab123@dismail.de", "password"); client.connectToServer(config, pres); if( client.isConnected()) qDebug() << "#######Connected to server#######"; }
I've tried few combinations, other QT clients(like qchat). they just printed "connecting to server" and nothing else. I think it may related to windows firewall or stuff
-
@Lertpan said in Can't connect to any server with QXmpp:
connectToServer
Isn't this method assynchronous?
-
signals and slots worked... exept seems it wasn't my real problem. This is the result when I run the code.
(I run the code in main instead pushbutton, it seemd i get better results)qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_ciphersuites qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_use_session_callback Sal Tem 9 10:01:51 2019 DEBUG Looking up server for domain dismail.de Sal Tem 9 10:01:51 2019 INFO Connecting to xmpp.dismail.de:5222 Sal Tem 9 10:01:51 2019 INFO Socket connected to 116.203.3.253 5222 Sal Tem 9 10:01:51 2019 SENT <?xml version='1.0'?><stream:stream to='dismail.de' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'> Sal Tem 9 10:01:51 2019 RECEIVED <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' from='dismail.de' id='c02f15e3-2bc1-478f-99f0-d1bab828efb1' version='1.0' xmlns='jabber:client'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'><required/></starttls></stream:features> Sal Tem 9 10:01:51 2019 SENT <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> Sal Tem 9 10:01:51 2019 RECEIVED <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/> Sal Tem 9 10:01:51 2019 DEBUG Starting encryption qt.network.ssl: QSslSocket: cannot call unresolved function SSL_set_psk_use_session_callback Sal Tem 9 10:01:52 2019 DEBUG Socket encrypted Sal Tem 9 10:01:52 2019 SENT <?xml version='1.0'?><stream:stream to='dismail.de' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'> Sal Tem 9 10:01:52 2019 RECEIVED <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' from='dismail.de' id='31257eb2-522a-4812-9787-107a42444c7a' version='1.0' xmlns='jabber:client'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>SCRAM-SHA-1-PLUS</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features> Sal Tem 9 10:01:52 2019 INFO SASL mechanism 'SCRAM-SHA-1' selected Sal Tem 9 10:01:52 2019 SENT <auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="SCRAM-SHA-1">biwsbj1hZG1pbnUscj1vS1pPNllwU2hnUnRibzN2cUJYY09mSTM5Qk5BL0xST1BaQ2Ixb1dDWGU4PQ==</auth> Sal Tem 9 10:01:52 2019 RECEIVED <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cj1vS1pPNllwU2hnUnRibzN2cUJYY09mSTM5Qk5BL0xST1BaQ2Ixb1dDWGU4PWMzZWEyMjNmLWEzNWYtNGRmZi1hMzkzLWQ5OTBiMGU4NGFmYSxzPU0yUXhZak5sWldJdE9XTmlZeTAwTldVMkxUZ3habUl0WW1FMllUQmxZall4TVdVMyxpPTQwOTY=</challenge> Sal Tem 9 10:01:52 2019 SENT <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">Yz1iaXdzLHI9b0taTzZZcFNoZ1J0Ym8zdnFCWGNPZkkzOUJOQS9MUk9QWkNiMW9XQ1hlOD1jM2VhMjIzZi1hMzVmLTRkZmYtYTM5My1kOTkwYjBlODRhZmEscD1ydUF2M2ZnYjBaTThYeThrYWVSdlZCWHlJUms9</response> Sal Tem 9 10:01:52 2019 RECEIVED <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dj1vVk43OHVRWHo0eUdLbzJYWjVWZWRPQ0FweXc9</success> Sal Tem 9 10:01:52 2019 DEBUG Authenticated Sal Tem 9 10:01:52 2019 SENT <?xml version='1.0'?><stream:stream to='dismail.de' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'> Sal Tem 9 10:01:52 2019 RECEIVED <?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' xml:lang='en' from='dismail.de' id='4ba9df6a-1f0d-4479-bce4-260561adc033' version='1.0' xmlns='jabber:client'><stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><required/></bind><session xmlns='urn:ietf:params:xml:ns:xmpp-session'><optional/></session><ver xmlns='urn:xmpp:features:rosterver'/><csi xmlns='urn:xmpp:csi:0'/><c hash='sha-1' ver='Nz/v/SF7wWEVWQVaki85LGo2xVo=' node='http://prosody.im' xmlns='http://jabber.org/protocol/caps'/><sm xmlns='urn:xmpp:sm:2'><optional/></sm><sm xmlns='urn:xmpp:sm:3'><optional/></sm></stream:features> Sal Tem 9 10:01:52 2019 SENT <iq id="qxmpp4" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>QXmpp</resource></bind></iq> Sal Tem 9 10:01:52 2019 RECEIVED <iq id='qxmpp4' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>adminu@dismail.de/QXmpp</jid></bind></iq> Sal Tem 9 10:01:52 2019 SENT <iq id="qxmpp6" to="dismail.de" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq> Sal Tem 9 10:01:52 2019 RECEIVED <iq id='qxmpp6' type='result' to='adminu@dismail.de/QXmpp' from='dismail.de'/> Sal Tem 9 10:01:52 2019 SENT <enable xmlns="urn:xmpp:sm:3" resume="true"/> Sal Tem 9 10:01:52 2019 RECEIVED <enabled id='3e6c4f39-faa9-4338-9690-2597f29a21bc' resume='true' max='120' xmlns='urn:xmpp:sm:3'/> Sal Tem 9 10:01:52 2019 SENT <iq id="qxmpp8" from="adminu@dismail.de/QXmpp" type="get"><query xmlns="jabber:iq:roster"/></iq> Sal Tem 9 10:01:52 2019 SENT <r xmlns="urn:xmpp:sm:3"/> Sal Tem 9 10:01:52 2019 SENT <presence><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="https://github.com/qxmpp-project/qxmpp" ver="A4UNkhgwYKwoeSXg5kRDnndukYY="/></presence> Sal Tem 9 10:01:52 2019 SENT <r xmlns="urn:xmpp:sm:3"/> Sal Tem 9 10:01:52 2019 RECEIVED <iq id='qxmpp8' type='result' to='adminu@dismail.de/QXmpp'><query ver='2' xmlns='jabber:iq:roster'><item jid='admin@dismail.de' ask='subscribe' subscription='none' name='admin@dismail.de'/></query></iq><a h='1' xmlns='urn:xmpp:sm:3'/><presence from='adminu@dismail.de/QXmpp'><c hash='sha-1' ver='A4UNkhgwYKwoeSXg5kRDnndukYY=' node='https://github.com/qxmpp-project/qxmpp' xmlns='http://jabber.org/protocol/caps'/><x xmlns='vcard-temp:x:update'/></presence><iq id='GkbtPm4f' type='set'><query ver='2' xmlns='jabber:iq:roster'><item jid='admin@dismail.de' ask='subscribe' subscription='none' name='admin@dismail.de'/></query></iq><presence type='unavailable' to='adminu@dismail.de' from='admin@dismail.de'/><a h='2' xmlns='urn:xmpp:sm:3'/> Sal Tem 9 10:01:52 2019 SENT <iq id="GkbtPm4f" type="result"/> Sal Tem 9 10:01:52 2019 SENT <r xmlns="urn:xmpp:sm:3"/> Sal Tem 9 10:01:52 2019 RECEIVED <r xmlns='urn:xmpp:sm:3'/> Sal Tem 9 10:01:52 2019 SENT <a xmlns="urn:xmpp:sm:3" h="4"/> Sal Tem 9 10:01:52 2019 RECEIVED <a h='3' xmlns='urn:xmpp:sm:3'/>
don't know if contains super secret info.
result doesn't change if password correct or not.
also tried on some machine does not prints ssl errors, result was familar to this -
You are missing the OpenSSL dlls. Get them for the same architecture and compiler as the Qt version you are using and copy them in the same folder as your application.
Or modify the PATH environment variable in Qt Creator in the Run part of the Project panel and add the path to the folder containing them. Depending on the Qt version you are using, either need the 1.0 or the 1.1 release. You can't mix both because the OpenSSL project broke compatibility between the two series.
-
@VRonin I have no errors or "Issues" with
-l:libqxmpp.dll
I'm stuck here like 5 days I've tried lot of dumb things. I've changed INCLUDEPATH and LIBS a lot, right now i dont have ""QXmppClient.h" could not find" error. But im worried if I couldn't build/integrate QXmpp library properly.
I think I dont have to specify im noob.
How it should be btw?
totally works btw