I'm writing a C# program to monitor all printers on the LAN via SNMP, using the open source #SNMP library (https://github.com/lextm/sharpsnmplib).
The method it uses for discovering SNMP devices is via UDP broadcast to the entire network (IPAddress.Broadcast = 255.255.255.255).
I have heard and read complaints from network administrators about broadcasting being bad practice that should be avoided by all means, because of poorly configured networks where it may flood the network to death.
So as an alternative method I tried the same library's Messenger.Get method in a loop, sending a unicast request to every ip in the local subnet range. There I also encountered a problem - using the non-async Get method in a loop takes too long. And the method's async sibling, GetAsync, hangs forever waiting for a response from all vacant ips, with no option to cancel the task or specify a timeout.
I'll be grateful to anyone who can point me in the right direction.
EDIT:
I've currently resorted to using Ping.SendPingAsync to ping in quick succession all ips in the subnet, and then sending an SNMP Get to those who responded to the ping. But I'm not sure if I can trust all printers to respond to pings. Could anyone please clarify this point as well?