AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones del protocolo SNMP
  • Using the SNMPTrapEnable function
SNMPTrapEnable (Example)
Using the SNMPTrapEnable function
Enables the interception of an SNMP trap sent by an agent.
// Start a session
gnSNMPSessionID = SNMPStartSession("127.0.0.1", "public")
// Service required, full name: "SNMP service", simple name: "SNMP"
 
IF gnSNMPSessionID = -1 THEN
Error("Error while opening the session " + ErrorInfo())
ELSE
// Capture the SNMP traps
gnSNMPTrapID = SNMPTrapEnable(SNMPReception, "", "", "")
//Service required, full name: "SNMP interruption", simple name: "SNMPTRAP"
IF gnSNMPTrapID =-1 THEN
Error("Error while activating the captures of SNMP traps " + ErrorInfo())
SNMPCloseSession(gnSNMPSessionID)
gnSNMPSessionID = -1
ELSE
Info("SNMP trap enabled")
END
END
//---------------------WITH the following procedure:
PROCEDURE SNMPReception(sAddress is string, ...
sCommunity is string, ...
  arrOID is array of strings, ...
  arrType is array of int, ...
  arrValues is array of strings)
 
// Serialize the arrays in XML in order to "easily" display them
// in a screen trace
bufTemp is Buffer
bufArrays is Buffer
Serialize(arrOID, bufTemp, psdXML)
bufArrays += CR + bufTemp
Serialize(arrType, bufTemp, psdXML)
bufArrays += CR + bufTemp
Serialize(arrValue, bufTemp, psdXML)
bufArrays += CR + bufTemp
 
// Trace the received parameters
Trace("Receiving SNMP trap at " + sAddress + ...
", community " + sCommunity + ...
", other info: " + bufArrays)
Versión mínima requerida
  • Versión 12
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local