Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="exeTime"></param>
        /// <param name="pOID"></param>
        /// <returns></returns>
        public string GetNextSnmp(out int exeTime, string pOID, ref string nextString)
        {
            string result = string.Empty;

            exeTime      = 0;
            GetLastError = string.Empty;

            int startCnt = Environment.TickCount;

            try
            {
                SnmpOidValue oidData = SNMP.GetNext(pOID);
                exeTime    = Environment.TickCount - startCnt;
                nextString = oidData.Oid;
                result     = oidData.Value.ToString();
                if (nextString[0] == '.')
                {
                    nextString = nextString.Substring(1);
                }
            }
            catch (SnmpException se)
            {
                SetLextmError(se);
            }
            catch (Exception ex)
            {
                GetLastError = "ERROR: " + ex.JoinAllErrorMessages();
            }
            finally
            {
                if (exeTime == 0 && startCnt != 0)
                {
                    exeTime = Environment.TickCount - startCnt;
                }
                if (result.Contains("NoSuch"))
                {
                    GetLastError = "ERROR: " + result;
                }
            }

            return(result);
        }