AddressHelper.
More...
#include <addresshelper.h>
|
| static bool | tryParseAddressPort (const QString &addressString, QString &address, quint16 &port) |
| | Parse a combined "address:port" string into its components.
|
| |
| static bool | tryParseAddressPort (const QString &addressString, QHostAddress &address, quint16 &port) |
| | Parse a combined "address:port" string into a QHostAddress and port.
|
| |
| static QHostAddress | resolveIPv4Address (const QString &hostName) |
| | Resolve a hostname to its IPv4 address.
|
| |
| static QHostAddress | getLocalIP () |
| | Get the local machine's primary IPv4 address.
|
| |
| static QHostAddress | getLocalIP (const QStringList &allowedInterfaces) |
| | Get the local machine's IPv4 address, filtered by allowed interface names.
|
| |
AddressHelper.
Some static helper methods for address resolution and parsing
Stephen Punak, July 08 2019
Static helper methods for network address resolution and parsing.
Definition at line 17 of file addresshelper.h.
◆ getLocalIP() [1/2]
| static QHostAddress AddressHelper::getLocalIP |
( |
| ) |
|
|
static |
Get the local machine's primary IPv4 address.
- Returns
- The local IPv4 QHostAddress
◆ getLocalIP() [2/2]
| static QHostAddress AddressHelper::getLocalIP |
( |
const QStringList & |
allowedInterfaces | ) |
|
|
static |
Get the local machine's IPv4 address, filtered by allowed interface names.
- Parameters
-
| allowedInterfaces | List of interface name patterns to consider |
- Returns
- The matching local IPv4 QHostAddress
◆ resolveIPv4Address()
| static QHostAddress AddressHelper::resolveIPv4Address |
( |
const QString & |
hostName | ) |
|
|
static |
Resolve a hostname to its IPv4 address.
- Parameters
-
| hostName | Hostname or IP address string to resolve |
- Returns
- Resolved QHostAddress, or QHostAddress() on failure
◆ tryParseAddressPort() [1/2]
| static bool AddressHelper::tryParseAddressPort |
( |
const QString & |
addressString, |
|
|
QHostAddress & |
address, |
|
|
quint16 & |
port |
|
) |
| |
|
static |
Parse a combined "address:port" string into a QHostAddress and port.
- Parameters
-
| addressString | Combined address and port string (e.g. "192.168.1.1:8080") |
| address | Output QHostAddress receiving the parsed address |
| port | Output variable receiving the port number |
- Returns
- true if parsing succeeded, false otherwise
◆ tryParseAddressPort() [2/2]
| static bool AddressHelper::tryParseAddressPort |
( |
const QString & |
addressString, |
|
|
QString & |
address, |
|
|
quint16 & |
port |
|
) |
| |
|
static |
Parse a combined "address:port" string into its components.
- Parameters
-
| addressString | Combined address and port string (e.g. "192.168.1.1:8080") |
| address | Output string receiving the address portion |
| port | Output variable receiving the port number |
- Returns
- true if parsing succeeded, false otherwise
The documentation for this class was generated from the following file: