Skip to content

Commit

Permalink
MQTT: hostname address resolver (#586)
Browse files Browse the repository at this point in the history
Currently one mqtt client requires an ip address. However, often we want to use hostname instead. This change should account for that
  • Loading branch information
lougovsk authored Aug 29, 2023
1 parent 43b9236 commit 7b5d756
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sources/mqtt/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ void mqtt::start(QString host, int port, QString username, QString password, boo
QSTRING_CSTR(host), port, (is_ssl) ? "SSL": "NO SSL", (!username.isEmpty() || !password.isEmpty()) ? "YES" : "NO", (ignore_ssl_errors) ? "YES" : "NO");

QHostAddress adr(host);
QHostInfo info = QHostInfo::fromName(host);
if (!info.addresses().isEmpty()) {
adr = info.addresses().first();
}


if (is_ssl)
Expand Down

0 comments on commit 7b5d756

Please sign in to comment.