alex-spataru / qMDNS

Implementation of a simple mDNS responder with Qt
MIT License
24 stars 7 forks source link

Problem when a hostname consists of multiple parts #4

Open vdaele opened 6 years ago

vdaele commented 6 years ago

Currently you are only encoding the first and last part hence a request to "a.b.local" is sent as "a.local"

Replacing

        /* Add name data */
        data.append (host.length());
        data.append (host.toUtf8());

        /* Add domain data */
        data.append (domain.length());
        data.append (domain.toUtf8());

with

        QStringList items = address.split (".");
        for (auto item: items) {
            data.append (item.length());
            data.append (item.toUtf8());
        }

might be sufficient to fix this