/// <summary> /// The trap receive. /// </summary> /// <param name="objBinary"> /// The obj binary. /// </param> /// <exception cref="NotImplementedException"> /// </exception> public void TrapReceive(byte[] objBinary) { object obj = null; try { obj = ObjectSerializer.DeSerializeBinary(objBinary); } catch (Exception ex) { Log.Error(string.Format("把二进制流序列化为Pdu对象失败!, 原因为{0}", ex.Message)); return; } var trapPdu = obj as AsnType; if (null == trapPdu) { return; } if (PduType.V2Trap == (PduType)trapPdu.Type) { this.SnmpV2TrapRelay(trapPdu as Pdu); } else { throw new NotImplementedException("收到了非Snmp V2版本的Trap PDU, 还未实现相应的处理!"); } }