Get SNMP protocol version from the packet. This routine does not verify if version number is valid. Caller
should verify that returned value represents a valid SNMP protocol version number.
CopyC#
Namespace:
SnmpSharpNetint protocolVersion = Packet.GetProtocolVersion(inPacket, inLength); if( protocolVersion != -1 ) { if( protocolVersion == SnmpConstants.SNMPV1 || protocolVersion == SnmpConstants.SNMPV2 || protocolVersion == SnmpConstants.SNMPV3 ) { // do something } else { Console.WriteLine("Invalid SNMP protocol version."); } } else { Console.WriteLine("Invalid SNMP packet."); }
Assembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.5.0.0 (0.5.0.0)
Syntax
| C# | Visual Basic | Visual C++ |
Parameters
- buffer
- array<
Byte
>[]()[]
BER encoded SNMP packet
- bufferLength
- Int32
Length of the BER encoded packet