pocoproject / poco-dnssd

POCO DNS-SD (Zeroconf) Wrapper Library for Bonjour and Avahi
Other
21 stars 13 forks source link

Data of additional TXT records not propagated by serviceResolved event #4

Open petersmar opened 7 years ago

petersmar commented 7 years ago

Created a Service instance incl. the properties parameter and registered it via the DNSSDResponder.

Poco::DNSSD::Service::Properties propsDEV2;
propsDEV2.add("txtvers", "1");
propsDEV2.add("wss-2", "/bacnet0815");
propsDEV2.add("prio-2", "1000");
propsDEV2.add("ttl-2", "300");
propsDEV2.add("rq-2", "3");

Poco::DNSSD::Service serviceDEV2(ni.index(), "1-0815.dev._sub", "", "_bacnet._tcp,dev", "", "", 8080, propsDEV2);
serviceHandleDEV2 = dnssdResponder.registerService(serviceDEV2);

Created a second Record and added it to the registered service.

char *propsDevString2 = "\x9txtvers=1\xewss-6=/bacnet2\xbprio-6=1000\x9ttl-6=500\x6rq-6=3";
Poco::DNSSD::Record rec2("1-0815.dev._sub._bacnet._tcp.local", Poco::DNSSD::Record::RT_TXT, 54, propsDevString2);
Poco::DNSSD::RecordHandle recordHandle2 = dnssdResponder.addRecord(serviceHandleDEV2, rec2);

Using wireshark I can see that both TXT records are propagated if I browse and resolve the service, but when iterating through the properties list (ServiceEventArgs::service.properties()) only the properties of the TXT Record created while creating the Service class instance are listed in properties, but the key-value-pairs of the second TXT Record added to the registered service are not included in the properties list (keys are all distinguishable).

Why is the data of the second TXT record not listed in the properties list? Is it related to the handling of subkeys as described in issue #2? Could the second record not associated to the first record and the service?

View to wireshark trace the naming of the records look correct.

petersmar commented 7 years ago

I retested it without using the "dev._sub." in the naming to check if it depends on the handling of the naming with subtypes. Change my code to:

Poco::DNSSD::Service serviceDEV2(ni.index(), "1-0815", "", "_bacnet._tcp,dev", "", "", 8080, propsDEV2);
Poco::DNSSD::Record rec2("1-0815._bacnet._tcp.local", Poco::DNSSD::Record::RT_TXT, 54, propsDevString2);

but the data of the second added TXT record was not included in the properties list.