Platform SDK: Network Management

SnmpCancelMsg

A WinSNMP application calls the SnmpCancelMsg function to request that the Microsoft WinSNMP implementation cancel retransmission attempts and time-out notifications for an SNMP request message. The SnmpCancelMsg function is an element of the WinSNMP API, version 2.0.

SNMPAPI_STATUS SnmpCancelMsg(
  HSNMP_SESSION session, // handle to the WinSNMP session
  smiINT32 reqId         // request_id field of the PDU
);

Parameters

session
[in] Handle to the WinSNMP session that submitted the SNMP request message (PDU) to be canceled.
reqId
[in] Specifies a unique numeric value that identifies the PDU of interest. This parameter must match the request identifier (request_id) of the PDU parameter specified in the application's initial call to the SnmpSendMsg function.

Return Values

If the function succeeds, the return value is SNMPAPI_SUCCESS.

If the function fails, the return value is SNMPAPI_FAILURE. To get extended error information, call SnmpGetLastError. The SnmpGetLastError function can return one of the following errors.

Error code Description
SNMPAPI_SESSION_INVALID The session parameter is invalid.
SNMPAPI_PDU_INVALID The reqId parameter does not identify an outstanding message for the specified session.
SNMPAPI_NOT_INITIALIZED The SnmpStartup function did not complete successfully.
SNMPAPI_ALLOC_ERROR An error occurred during memory allocation.
SNMPAPI_OTHER_ERROR An unknown or undefined error occurred.

Remarks

Calling the SnmpCancelMsg function is equivalent to calling the SnmpSetRetransmitMode function, for a specific SNMP message, with the retransmission mode equal to SNMPAPI_OFF.

For more information, see Canceling Retransmission and Managing the Retransmission Policy.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winsnmp.h.
  Library: Use Wsnmp32.lib.

See Also

WinSNMP API Overview, WinSNMP Functions, SnmpSendMsg, SnmpSetRetransmitMode