title: how to use snmpwalk in c++
body: <p>i m using net-snmp in my code .
  for snmpget i use this code and it is 100 % correct . </p>
  
  <pre><code> string oiids =  ".1.3.6.1.4.1.30429.1.3.2.1.0" ;  
   struct snmp_session session , *ss ;
   struct snmp_pdu *pdu;
   struct snmp_pdu *response;
   oid anOID[MAX_OID_LEN];
   size_t anOID_len = MAX_OID_LEN;
   int status;
   init_snmp("APC Check");
   snmp_sess_init( &amp;session );
   ss = snmp_open(&amp;session);
   session.peername = "192.168.17.74";
   session.community = (u_char *) "public";
   session.community_len = strlen("public");
   session.version = SNMP_VERSION_2c;
   ss = snmp_open(&amp;session);
   pdu = snmp_pdu_create(SNMP_MSG_GET);
   read_objid(oiids.c_str(), anOID, &amp;anOID_len);
   snmp_add_null_var(pdu, anOID, anOID_len);
   status = snmp_synch_response(ss, pdu, &amp;response);
   for(variable_list * vars = response-&gt;variables; vars; vars = vars-&gt;next_variable)
           print_variable(vars-&gt;name, vars-&gt;name_length, vars);
  </code></pre>
  
  <p>but this code doesn't work with the OID which have multi row's answer.
  by changing this line      pdu = snmp_pdu_create(SNMP_MSG_GET)  to this
       pdu = snmp_pdu_create(SNMP_MSG_GETNEXT); this code return only first row .</p>
  
  <p>thats the problem , how could i get all rows not just first one </p>