FTP | CCD | Buscar | Trucos | Trabajo | Foros |
#1
|
|||
|
|||
Indy 9
Hola,
Tengo un problemilla con Indy 9, mas en concreto con el componente TidSNMP, puedo leer perfectamente cualquier OID, pero no soy capaz de modificar ningun valor. Os dejo la función a ver si me podeis decir que es lo que está mal: ----------------------------------------------------------------------- function TfrmMainSNMP.GetOID(OID: String; var Reply, Error: String): Boolean; var Tmp: String; begin Result := False; try if SNMP = Nil then begin SNMP := TIdSNMP.Create(nil); end; if not LeerIni(RutaIni, 'HOST', 'Address', Tmp, '', Error) then begin GrabarLog(RutaLog, Error, Error); end; IP := Tmp; SNMP.Community := 'public'; SNMP.Host := IP; SNMP.Query.Clear; SNMP.Query.PDUType := PDUGetRequest; SNMP.Query.MIBAdd(OID, ''); snmp.Active := True; if not SNMP.SendQuery then begin Error := 'Error al consultar OID(' + IntToStr(SNMP.Query.ErrorStatus) + '): ' + OID; memo1.Lines.Add(Error); end else begin Reply := SNMP.Reply.Value[0]; memo1.Lines.Add(Trim(SNMP.Reply.MIBOID.Text) + ': ' + Trim(SNMP.Reply.MIBValue.Text)); end; Result := True; Except On E: Exception do begin Error := 'Error en la función (TfrmMainTPVSNMP)ConsultarOID. ' + E.Message; end; end; end; ------------------------------------------------------------------------ function TfrmMainSNMP.SetOID(OID: String; Value: String; var Error: String): Boolean; var Tmp: String; begin Result := False; try if SNMP = Nil then begin SNMP := TIdSNMP.Create(nil); end; if not LeerIni(RutaIni, 'HOST', 'Address', Tmp, '', Error) then begin GrabarLog(RutaLog, Error, Error); end; IP := Tmp; SNMP.Community := 'public'; SNMP.Host := IP; SNMP.Query.Clear; SNMP.Query.MIBAdd(OID, Value); SNMP.Query.PDUType := PDUSetRequest; if not SNMP.SendQuery then begin Error := 'Error al Escribir en OID: ' + OID + '(' + Value + ')'; end else begin snmp.Reply.MIBGet(OID); memo1.Lines.Add('OID ' + OID + ' = ' + Value + '.'); end; Result := True; Except On E: Exception do begin Error := 'Error en la función (TfrmMainTPVSNMP)ConsultarOID. ' + E.Message; end; end; end; |
|
|
|