Application based on qxmpp can't connect to server on Android, but working well on windows

青春壹個敷衍的年華 提交于 2019-12-12 23:41:48

问题


I'm using qxmpp library in my project. I've tried to write simple app to find out if it connects to server. It connects on Windows well. Then I've tried to test it on Android, but it doesn't connect and I don't know why because it shows no error.

The app running correctly on Android, but it seems nothing is going on about XMPP protocol. No connection and logging. All I got in debug() just this one line:

D/libc-netbsd(  465): getaddrinfo: gmail.com get result from proxy >>

This is my first try:

lbl.setText("is not Connected");
client.connectToServer("hami....@gmail.com", "asdasd");
while(!(client.isConnected())){
    a.processEvents();
}
lbl.setText("Connected");

it does connect but just on Windows. I've tried the GuiClient project, both of them seems not working.

I changed this line

DEFINES +=  QXMPP_LIBRARY_TYPE=staticlib

to

DEFINES +=  QXMPP_LIBRARY_TYPE=shared

and build libqxmpp.so but nothing again.

I wrote these lines in my application's .pro file for adding library to my project.

CONFIG(debug, debug|release) {
    win32{
        QXMPP_LIBRARY_NAME_INC = qxmpp_d0
    } else {
        QXMPP_LIBRARY_NAME_INC = qxmpp_d
    }
}else{
    win32{
        QXMPP_LIBRARY_NAME_INC = qxmpp0
    }else{
        QXMPP_LIBRARY_NAME_INC = qxmpp
    }
}
LIBS += -L./qxmpp/src -l$$QXMPP_LIBRARY_NAME_INC

Thanks in advance.


回答1:


That was because of QDnsLookup was not developed for Android. And i pass this problem by using IP address of my own servers. (Its didn't work by Google servers using ip address)



来源:https://stackoverflow.com/questions/28586388/application-based-on-qxmpp-cant-connect-to-server-on-android-but-working-well

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!