|
|
| MulticastDns (const std::string &serviceType={}) |
| |
|
int | sendQuery (int timeout=0) |
| |
|
const std::vector< Host > | hosts () const |
| |
|
void | setServiceType (const std::string &_serviceType) |
| |
|
std::string | serviceType () |
| |
|
bool | startService (const std::string &hostname, const std::string &llip, const std::string &misc, uint16_t port) |
| |
|
void | stopService (bool send_goodbye=true) |
| |
|
bool | serviceRunning () |
| |
|
bool | startQuerier (int timeout=60) |
| |
|
void | stopQuerier () |
| |
|
bool | querierRunning () |
| |
|
void | append_ (const Host &host) |
| |
The MulticastDns class.
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", "169.254.0.1", "AsyncFw_misc_string", 18080);
_mdns.startQuerier(1);
lsNotice() << "Start Applicaiton";
int ret = MainThread::exec();
lsNotice() << "End Applicaiton" << ret;
return ret;
}