Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qhostinfo_win.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <winsock2.h>
5
6#include "qhostinfo_p.h"
7#include <ws2tcpip.h>
8#include <private/qsystemlibrary_p.h>
9#include <qmutex.h>
10#include <qbasicatomic.h>
11#include <qurl.h>
12
14
15//#define QHOSTINFO_DEBUG
16
17//###
18#ifndef NI_MAXHOST // already defined to 1025 in ws2tcpip.h?
19#define NI_MAXHOST 1024
20#endif
21
23{
24 QSysInfo::machineHostName(); // this initializes ws2_32.dll
25
27
28#if defined(QHOSTINFO_DEBUG)
29 qDebug("QHostInfoAgent::fromName(%s) looking up...",
30 hostName.toLatin1().constData());
31#endif
32
34 if (address.setAddress(hostName))
35 return reverseLookup(address);
36
37 return lookup(hostName);
38}
39
40// QString QHostInfo::localDomainName() defined in qnetworkinterface_win.cpp
41
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:124
The QHostAddress class provides an IP address.
static QHostInfo lookup(const QString &hostName)
static QHostInfo reverseLookup(const QHostAddress &address)
static QHostInfo fromName(const QString &hostName)
The QHostInfo class provides static functions for host name lookups.
Definition qhostinfo.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QByteArray toLatin1() const &
Definition qstring.h:630
static QString machineHostName()
Definition qsysinfo.cpp:929
Combined button and popup list for selecting options.
#define qDebug
[1]
Definition qlogging.h:164
GLuint GLuint64EXT address