/** * Test for QUdpSocket::bind() * * - Works with Qt5.7.1 * * - Failes with Qt5.8.0 * Error: Server::errorUdpSocket() - socketError: QAbstractSocket::UnsupportedSocketOperationError * Error: Server::start() - QUdpSocket::bind(Any, 8123) failed - The proxy type is invalid for this operation * */ #include #include class Server : public QObject{ Q_OBJECT public: void start() { connect(&m_udpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorUdpSocket(const QAbstractSocket::SocketError&))); if (!m_udpSocket.bind(QHostAddress::Any, 8123)) { qDebug() << "Error: Server::start() - QUdpSocket::bind(Any, 8123) failed - " << m_udpSocket.errorString().toStdString().c_str(); exit(-1); } qDebug() << "Debug: Server::start() - bind(Any, 8123) succeeded"; } private slots: void errorUdpSocket(const QAbstractSocket::SocketError& socketError) { qDebug() << "Error: Server::errorUdpSocket() - socketError: " << socketError; } private: QUdpSocket m_udpSocket; }; int main(int argc, char* argv[]) { QCoreApplication a(argc, argv); Server server; server.start(); return a.exec(); } #include "test_qudpsocket_004.moc"