如题,最好有代码,再次感谢

解决方案 »

  1.   

    ping你的目标机器,代码去百度一下,多的是。
      

  2.   

    用delphi自带的indy控件就可以了
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
      IdIcmpClient;type
      TForm1 = class(TForm)
        IdIcmpClient1: TIdIcmpClient;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    begin
    IdIcmpClient1.Host:='192.168.0.211';
    IdIcmpClient1.ping;
    if IdIcmpClient1.ReplyStatus.BytesReceived <= 0 then
      ShowMessage('对方机未开')
      else
      ShowMessage('对方机已开')end;end.