Hallo Community,
Ich bin gerade dabei ein Tcp Socket zuerstellen der auf ein Webspace verbindet. Ich bekomme leider irgendwie keine Antwort vom Server.
Hier der Code:
Code
cout << "Es wird nach neuen MTA Updates gesucht" << endl;
QTcpSocket *socket = new QTcpSocket();
socket->connectToHost("nightly.mtasa.com",80);
if (!socket->waitForConnected(5000)){
cout << "Connection failed!" << endl;
return false;
}
socket->write(QString("GET / HTTP/1.1").toUtf8());
socket->flush();
socket->write(QString("Host: nightly.mtasa.com\n").toUtf8());
socket->flush();
cout << "Abfrage Gesendet" << endl;
QByteArray HTML = "";
while (socket->canReadLine())
{
cout << QString(socket->readLine()).toStdString();
}
//QString HTMLString = QString::fromUtf8(HTML.trimmed());
//cout << "HTML: " <<HTMLString.toStdString();
return true;
Alles anzeigen
Console:
mfg,
Soner