Add a couple of headers that Qt 5.8 seems to be more picky about, and fix the free port check to use TCP not UDP

This commit is contained in:
Dave Page 2017-03-26 21:02:15 -04:00
parent c391696054
commit ea6d97c49d

View File

@ -16,6 +16,8 @@
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#include <QNetworkRequest>
#include <QNetworkReply>
#else
#include <QApplication>
#include <QDebug>
@ -66,8 +68,8 @@ int main(int argc, char * argv[])
// Hence - putting this code in a code block so the scope of the socket
// variable vanishes to make that socket available.
{
QUdpSocket socket;
socket.bind(0, QUdpSocket::ShareAddress);
QTcpSocket socket;
socket.bind(0, QTcpSocket::ShareAddress);
port = socket.localPort();
}