and i have a simple implementaion for event handlers like below
void on_service_found(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& arguments)
{
reinterpret_cast<Poco::DNSSD::DNSSDBrowser*>(const_cast<void*>(sender))->resolve(arguments.service));
}
void on_service_resolved(const void* sender, const Poco::DNSSD::DNSSDBrowser::ServiceEventArgs& arguments)
{
static int a = 0;
std::cout << "number of on service resolved calls: " << ++a << std::endl;
}
I expect that after the run program i see 2 line and last a equal to 2, but i see 3 line and last a equal to 3.
I think the problem is resolver run in background continuously, for each on_service_found called and it does not stop after new resolve called. However, the documentation of resolve method in DNSSDBrowser.h file says: "After either the serviceResolved or resolveError event has been fired, the returend BrowseHandle is no longer valid" so i think resolve will be stop after fire serviceResolved, But it does not follow behavior that i guess.
I have two question about that:
Is this an bug or not?
If this does not a bug, so what is the solution for call on_service_resolve only twice?
ITNOA
Hi,
I have a main code like below
and i have a simple implementaion for event handlers like below
I expect that after the run program i see
2
line and lasta
equal to2
, but i see3
line and lasta
equal to3
.I think the problem is resolver run in background continuously, for each
on_service_found
called and it does not stop after newresolve
called. However, the documentation ofresolve
method in DNSSDBrowser.h file says: "After either the serviceResolved or resolveError event has been fired, the returend BrowseHandle is no longer valid" so i thinkresolve
will be stop after fireserviceResolved
, But it does not follow behavior that i guess.I have two question about that:
on_service_resolve
only twice?thanks a lot