SnmpClose function (winsnmp.h)
[SNMP is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use Windows Remote Management, which is the Microsoft implementation of WS-Man.]
The SnmpClose function enables the Microsoft WinSNMP implementation to deallocate memory, resources, and data structures associated with a WinSNMP session. The WinSNMP SnmpClose function also closes communications mechanisms the implementation opened as a result of a call to the SnmpCreateSession function.
SNMPAPI_STATUS SNMPAPI_CALL SnmpClose( [in] HSNMP_SESSION session );
Handle to the WinSNMP session to close.
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 specifying a NULL value in its session parameter. The SnmpGetLastError function can return one of the following errors.
||The SnmpStartup function did not complete successfully.|
||An error occurred during memory allocation.|
||The session parameter is invalid.|
||An unknown or undefined error occurred.|
It is recommended that a WinSNMP application call the SnmpClose function once for each session that the application opened using the SnmpCreateSession function. If a WinSNMP application terminates unexpectedly, it must call SnmpCleanup before it terminates to enable the implementation to deallocate all resources. The implementation processes one SnmpCleanup call as if it were a series of SnmpClose calls, one call for each session opened as a result of a call to SnmpCreateSession.
When the implementation closes a session it discards all outstanding incoming and outgoing asynchronous requests and replies for the session. For additional information, see WinSNMP Sessions.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|