SNMP Manager Programmer's Guide

Programming Examples
SNMP Manager Programmer’s Guide–134249
2-134
SNMPHOST Source Code
{
fprintf(stdout, "SNMP_WRITEREAD_ returned error %i (", err1);
fprintf(stdout, SNMP_FS_ErrMsg_ (err1, host_int->err_num));
fprintf(stdout, ")\n");
SNMP_Free(recv_pkt);
} else break;
} /* for (i = 0; i <= retrycnt; i++) */
if (i > retrycnt) exit(0);
SNMP_Free(pkt); <--24
EBufferReset(&ebuff);
pkt = recv_pkt; <--25
if (pkt == 0) {
printf ("No response from host.\n");
printf ("Check to see if the agent is running.\n");
exit(0);
} /* no response from host */
switch (pkt->pdu.std_pdu.error_status) {
case NO_ERROR:
break;
case NO_SUCH_NAME:
printf ("Reached the end.\n");
printf ("Check to see if this host supports the host MIB.\n");
bMoreEntries = 0;
break;
default:
printf ("Unexpected SNMP error (%d) returned.\n",
pkt->pdu.std_pdu.error_status);
exit(0);
} /* switch error_status */
if (!bMoreEntries)
break;
/* Modify the received packet into another get next */
/* Clean up the error fields if any. */
Example 2-18. Contents of snmphosc (page 9 of 23)