D
Dan Pavel
Hi,
I have a function, mib_read_getnext, where I get a MIB subtree. It works
well but randomly hangs. I am using snmp.dll from
http://www.c-sharpcorner.com/Code/2002/Sept/SnmpLib.asp
How I can check that when I create a new ms is hanged or not and if it
is hanged, bypass it and assign val="0";
I am kind of new in programming, so if you can, give me a detailed
answer with code.
Thanks in advance.
---- My code----
private string mib_read_getnext(string host, uint[] mib)
{
lock(this)
{
string val="";
try
{
ManagerSession sess = new ManagerSession(host,"public");
ManagerSubTree ms = new ManagerSubTree(sess,mib);
//---^--- Above is the Crash !!!
if (ms.Length==0)
{
val="0";// SubTree is empty
}
else
foreach(ManagerItem mi in ms)
{
val=mi.Value.ToString();
}
}
catch (Exception e)
{
val="NULL";
}
return val;
I have a function, mib_read_getnext, where I get a MIB subtree. It works
well but randomly hangs. I am using snmp.dll from
http://www.c-sharpcorner.com/Code/2002/Sept/SnmpLib.asp
How I can check that when I create a new ms is hanged or not and if it
is hanged, bypass it and assign val="0";
I am kind of new in programming, so if you can, give me a detailed
answer with code.
Thanks in advance.
---- My code----
private string mib_read_getnext(string host, uint[] mib)
{
lock(this)
{
string val="";
try
{
ManagerSession sess = new ManagerSession(host,"public");
ManagerSubTree ms = new ManagerSubTree(sess,mib);
//---^--- Above is the Crash !!!
if (ms.Length==0)
{
val="0";// SubTree is empty
}
else
foreach(ManagerItem mi in ms)
{
val=mi.Value.ToString();
}
}
catch (Exception e)
{
val="NULL";
}
return val;