在网上找拉一天关与SNMP的东东,在delphi中好象只有IdSNMP这个控件但网上基本是没有完整使用案例。不知道那些高手可以共同帮在下一下

解决方案 »

  1.   

    copy 来的,呵呵interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdUDPBase, IdUDPClient,
      IdSNMP;type
      TForm1 = class(TForm)
        snmp: TIdSNMP;
        Memo1: TMemo;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
     origOID:string;
     i:integer;
    begin
        SNMP.Community := 'public';
        SNMP.Host := '202.202.41.173';
        SNMP.Query.Clear;
        origOID := '1.3.6.1.2.1.2.2.1.16';
        SNMP.Query.MIBAdd(origOID, '');
        SNMP.Query.PDUType := PDUGetNextRequest;
        while SNMP.SendQuery do
          begin
            if Copy(SNMP.Reply.MIBOID[0], 1, Length(origOID)) <> origOID then
              Break;
            for I := 0 to SNMP.Reply.ValueCount - 1 do
             memo1.Lines.Add(SNMP.Reply.Value[I]);
            SNMP.Query.Clear;
            SNMP.Query.MIBAdd(SNMP.Reply.ValueOID[0], '');
            SNMP.Query.PDUType := PDUGetNextRequest;
          end;
    end;end.
      

  2.   

    直接用windows api
    http://borland.mblogger.cn/jinjazz/posts/18391.aspx