Thema: Delphi Ping & Windows 7

Einzelnen Beitrag anzeigen

capo

Registriert seit: 7. Jul 2006
453 Beiträge
 
Delphi 11 Alexandria
 
#1

Ping & Windows 7

  Alt 27. Jan 2010, 12:07
Hallo...
folgende meldung erhalte ich bei unten stehendem Code.
Ich kann unter Windows 7 nicht mehr pingen, kann mir jemand dabei helfen?

Zitat:
---------------------------
Project1
---------------------------
Socket kann nicht zugewiesen werden.
---------------------------
OK
---------------------------
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, IdBaseComponent, IdComponent, IdRawBase, IdRawClient,
  IdIcmpClient, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ICMP: TIdIcmpClient;
    ListBox1: TListBox;
    procedure ICMPReply(ASender: TComponent;
      const AReplyStatus: TReplyStatus);
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ICMPReply(ASender: TComponent;
  const AReplyStatus: TReplyStatus);

var
  sTime: string;
begin
  if (AReplyStatus.MsRoundTripTime = 0) then
    sTime := '< 1'
  else
    sTime := '=';

  Listbox1.Items.Add(Format('%d bytes from %s: icmp_seq=%d ttl=%d time%s%d ms',
                            [AReplyStatus.BytesReceived,
                             AReplyStatus.FromIpAddress,
                             AReplyStatus.SequenceId,
                             AReplyStatus.TimeToLive,
                             sTime,
                             AReplyStatus.MsRoundTripTime]));
end;


procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin
Icmp.Host := 'www.delphi-treff.de';
for i := 1 to 4 do
begin
  Icmp.Ping;
   Application.ProcessMessages;
end;
end;
end.
Hotte
  Mit Zitat antworten Zitat