summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/kernel
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-08-29 11:52:10 -0700
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-09-14 13:17:02 +0000
commit5d48143ff8f358b3049279871e9959667e38b9e9 (patch)
treee2b8205d36108a380c7295c8efc45e1e67cfe7d3 /tests/auto/network/kernel
parent6aa001570da383b60eb72344bf5edbb28725932f (diff)
Autotest: use QUdpSocket instead of QTcpSocket in tst_QNetworkInterface
We don't need to bother the network test server with a TCP SYN packet. All we need is for the local operating system to figure out the IP address it would use to send a packet to the test server. We can do that with QUdpSocket. Also, the network test server hasn't been called "fluke.troll.no" for almost a decade. Change-Id: I209fcd5dbc2b4e5381cffffd14df65ccc7133247 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network/kernel')
-rw-r--r--tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
index 5695f90c53..e9034deff7 100644
--- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
+++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp
@@ -32,7 +32,7 @@
#include <qcoreapplication.h>
#include <qnetworkinterface.h>
-#include <qtcpsocket.h>
+#include <qudpsocket.h>
#ifndef QT_NO_BEARERMANAGEMENT
#include <QNetworkConfigurationManager>
#include <QNetworkSession>
@@ -189,17 +189,12 @@ void tst_QNetworkInterface::loopbackIPv6()
void tst_QNetworkInterface::localAddress()
{
- QTcpSocket socket;
+ QUdpSocket socket;
socket.connectToHost(QtNetworkSettings::serverName(), 80);
QVERIFY(socket.waitForConnected(5000));
QHostAddress local = socket.localAddress();
- // make Apache happy on fluke
- socket.write("GET / HTTP/1.0\r\n\r\n");
- socket.waitForBytesWritten(1000);
- socket.close();
-
// test that we can find the address that QTcpSocket reported
QList<QHostAddress> all = QNetworkInterface::allAddresses();
QVERIFY(all.contains(local));