public static void Main(string[] args) { if (args.Length != 0) { return; } Discoverer discoverer = new Discoverer(); discoverer.AgentFound += DiscovererAgentFound; Console.WriteLine("v1 discovery"); discoverer.Discover(VersionCode.V1, new IPEndPoint(IPAddress.Broadcast, 161), new OctetString("public"), 6000); Console.WriteLine("v2 discovery"); discoverer.Discover(VersionCode.V2, new IPEndPoint(IPAddress.Broadcast, 161), new OctetString("public"), 6000); Console.WriteLine("v3 discovery"); discoverer.Discover(VersionCode.V3, new IPEndPoint(IPAddress.Broadcast, 161), null, 6000); Console.Write("Press any key to continue . . . "); Console.ReadKey(true); }
/// <summary> /// Discover SNMP V1, V2 and V3 agents on a network. /// </summary> /// <param name="broadcastIP">Endpoint that signifies the broadcast IP, must be IPv4</param> internal static void DiscoverSNMPAgents(IPEndPoint broadcastIP) { Discoverer disc = new Discoverer(); disc.AgentFound += new EventHandler<AgentFoundEventArgs>(SNMPAgentFoundHandler); disc.Discover(VersionCode.V1, broadcastIP, new OctetString("public"), 50); }