MulticastDns example
#include <AsyncFw/MulticastDns>
#include <AsyncFw/MainThread>
#include <AsyncFw/Timer>
#include <AsyncFw/LogStream>
using namespace AsyncFw;
int main(int argc, char *argv[]) {
_mdns.
hostAdded([](
const MulticastDns::Host &host) { lsInfoGreen() <<
"Added" << host.
name << host.
ipv4 << host.
llipv4 << host.
misc << host.
port; });
_mdns.hostChanged([](const MulticastDns::Host &host) { lsInfoMagenta() << "Changed" << host.name << host.ipv4 << host.llipv4 << host.misc << host.port; });
_mdns.hostRemoved([](const MulticastDns::Host &host) { lsInfoRed() << "Removed" << host.name << host.ipv4 << host.llipv4 << host.misc << host.port; });
_mdns.startService("AsyncFw_host", "AsyncFw_misc_string", 18080);
_mdns.startQuerier(1);
lsNotice() << "Start Applicaiton";
int ret = MainThread::exec();
lsNotice() << "End Applicaiton" << ret;
return ret;
}
The MulticastDns class.
Definition MulticastDns.h:10
static void single(int ms, T function)
Starts a single shot timer with the specified timeout.
Definition Timer.h:19