I am trying to connect to server using QTCPSocket::connectToHost. On WinCE and s60 devices. If I uses comparitively high network protocols(WiFi), is goes well.
But when I uses slow network protocols (gprs, hspda, umts, edge). It fails in connection.
Does anyone here face this issue, using QTCPSocket ?
#include <QApplication>
#include <QMessageBox>
#include <QTcpSocket>
//#define API_URL "www.google.com"
#define API_URL "64.233.189.99"
int main(int argc, char *argv[])
{
sock.connectToHost(API_URL, 80);
if(!sock.waitForConnected())
{
return false;
}
return 0;
}
#include <QApplication>
#include <QMessageBox>
#include <QTcpSocket>
//#define API_URL "www.google.com"
#define API_URL "64.233.189.99"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTcpSocket sock;
sock.connectToHost(API_URL, 80);
if(!sock.waitForConnected())
{
QMessageBox::information(0,0,"Failed");
return false;
}
QMessageBox::information(0,0,"Connected");
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks