I have been having many issues with trying to scan a range of ips for the specified Oid, like the Solarwinds Snmp Sweeper does. The reason why Solarwinds snmp tools lack is because they are too slow when checking larger ranges.
I am receiving a timeout error at about 62 hosts now. I am running a task factory to check each host in parallel to eachother. I am still recieving a timeout error. I noticed SharpSnmpNet has the same problem.
I believe being able to dispose the listener might help, because I think it is staying open even though it has received it's reply. This should not be happening but I believe it is because I am receiving multiple replies at the same time even though they have different target hosts.
How can I dispose the listener. Here is the only place I am calling sharpsnmp this is the function my tasks are executing.
Mr. Lex Li: I would be unbelievably grateful if you could reply:
public string ProcessData()
{
var receiver = new IPEndPoint(Ip, Config.Port);
var vList = Config.SnmpOids.Select(item => new Variable(new ObjectIdentifier(item))).ToList();
IList<Variable> vars = Messenger.Get(VersionCode.V2, receiver, new OctetString(Config.Community), vList,
Config.TimeOut);
foreach (Variable variable in vars)
{
// Lets create a string based on our returned variable binding value.
var outBuilder = new StringBuilder();
if (!(variable.ToString().Contains("NoSuchObject")))
{
outBuilder.Append(variable.Data + " ][ ");
}
string outPut = outBuilder.ToString();
if (!(String.IsNullOrEmpty(outPut)))
{
return outPut;
//Invoke our callback
//outputTree.BeginInvoke(new StringDelegate(UpdateScan), outPut, ip.ToString());
//txtFound.BeginInvoke(new StringDelegate(UpdateScan), 1);
}
}
return null;
}