Search code examples
c#snmpsharp-snmp

SharpSNMP max-repetitions increase causes buffer size exception through GPRS


I am trying to send SNMP requests to a remote location.

I am using the SharpSNMP 8.5.0 library and the Snmp.BulkWalk example from a code project post ( here ).

In the example, they use 10 as max-repetitions and using sniffing software I noticed that is creating multiple datagram packets to make the walk within in the subtree. Actually I am getting 120 packets results back every time. So I decided to try a higher max-repetitions number and I noticed that the packets number is going down, actually I can get all the data in one packet. Now I have another problem: the remote device is using GPRS when I snmpwalk on the device from the server using GPRS, I get a timeout or a buffer out of size error. When I run the same solution on my local PC and I access the remote device from my router(no GPRS involved) I don't get any errors and get all the data!

Can someone explain this behavior? Does it have to do with a GPRS limitation? GPRS is unreliable? Or is it a network limitation on the server?

(The MTU in the server is 1500). Does anyone have an experience on the best practices and the optimal packet size that can send through SNMP-UDP datagram packets?


Solution

  • Though I am the author of that library, I could not answer the GPRS part, as I am not a mobile network expert.

    What I could answer is the packet number part, which is relatively simple if you check out the definition of "max-repititions",

    https://www.webnms.com/snmp/help/snmpapi/snmpv3/v2c/maxrepetition.html

    By setting a larger value to this parameter, a single packet can contain more results, and obviously less packets are needed.

    I used 10 in that Code Project article, because it was just an example. You might see from the link above that other libraries might use 50 as the default.