Hi Geet,
Please send the value of the following,
for(vars = response->variables; vars; vars = vars->next_variable)
print_variable(vars->name, vars->name_length, vars);
________________________________
From: Geet Bhatia <geetbhati...@gmail.com>
To: Net-snmp-coders@lists.sourceforge.net
Sent: Monday, 9 September 2013 2:22 PM
Subject: Problem in snmpget
Hi,
I have written a code to send snmp request and receive response from agent. The
program is also processing the response. For this I memcpy the response in a
buffer. I am using the following code to copy the response after receiving it
in "response" snmp_pdu variable:
for(vars=response->variables;vars;vars=vars->next_variable)
{
if(vars->type == ASN_OCTET_STR)
{
char *sp = (char*)malloc(1+vars->val_len);
memcpy(sp,vars->val.string,vars->val_len);
sp[vars->val_len] = '\0';
//process the sp buffer
}
}
The response is of 40 Bytes of ASN_OCTET_STR. The first byte of response is
always 0.
Problem: The problem is I am not getting anything in vars->val.string. Though
the length returned by vars->val_len is 40 and data type returned by vars->type
is ASN_OCTET_STR.
The value sent by agent is correct. I have checked it on wireshark. Even the
print_variable is printing correct value on console. But I am not able to get
this value copied in buffer.
I have also used the function snprint_variable but that too is copying 0 in
buffer.
I have also debug the code and the value in vars->val.string is zero.
Please help me in resolving this problem.
Thanks & RegardsGeet Bhatia
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders