Home > Software engineering >  Why don't WINSNMP reply from port 161?
Why don't WINSNMP reply from port 161?

Time:09-25

Newbie questions, after I receive the SNMP message, why don't reply message from port 161 reply, how can through port 161 reply:
Receiving
 ret=SnmpRecvMsg (hSession, & amp; HSrcAgent, & amp; HDstAgent, & amp; HContext, & amp; HRecvPDU); 
Ret=SnmpGetPduData (hRecvPDU, & amp; PduType, & amp; RequestId, & amp; The status, & amp; The index, & amp; HRecvVbl);

Processing and reply
 count=SnmpCountVbl (hRecvVbl); 
I=SNMP_SYNTAX_INT;
for(i=1; i<=count; I++)
{
Ret=SnmpGetVb (hRecvVbl, I, & amp; The name, & amp; Value);
if(ret !=SNMPAPI_SUCCESS)
{
Printf (" Error: % d \ n ", SnmpGetLastError (hSession));
continue;
}
Ret=SnmpOidToStr (& amp; Name, sizeof (buffer), buffer);
If (ret==SNMPAPI_FAILURE)
{
Printf (" Error1: % d \ n ", SnmpGetLastError (hSession));
continue;
}
Type: name: printf (" % s % d \ n ", buffer, the value. The syntax).
If (value. The syntax==SNMP_SYNTAX_INT)
{
Printf (" \ n Value: % d ", Value, Value, sNumber);
}
}
SmiOCTETS obj.
HSNMP_VBL HVBL;
HSNMP_PDU pdu.
Obj. Len=strlen (community);
Obj. PTR=(smiLPBYTE) community;
HContext=SnmpStrToContext (hSession, & amp; Obj);
HVBL=SnmpCreateVbl (hSession, NULL, NULL);
Ret=SnmpStrToOid (". 1.3.6.1.2.1.25.2.2.0 ", & amp; Name);
Ret=SnmpSetVb (HVBL, 0, & amp; The name, NULL);
Pdu=SnmpCreatePdu (hSession, SNMP_PDU_RESPONSE, 0, 0, 0, HVBL);
Ret=SnmpSendMsg (hSession hDstAgent, hSrcAgent, hContext, pdu);

CodePudding user response:

caught?

CodePudding user response:

reference 1st floor zhao4zhong1 response:
caught?

Well, caught see, send to come over to the SRC port=161, but reply the past DST port is not 161, and is corresponding to a port

CodePudding user response:

On agent process is known as port 161 to receive the get or set of message, and in the administrative process end is known as port 162 to receive the trap message?
  • Related