Hello,
first of all, excuse my bad english.
I'm new to programming. I've tried a long time to achieve a succesful ping. Here is my code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, blcksock, synautil, synsock, pingsend;
type
{ TForm1 }
TForm1 = class(TForm)
Button_close: TButton;
Button_ping: TButton;
Edit1: TEdit;
Memo1: TMemo;
procedure Button_closeClick(Sender: TObject);
procedure Button_pingClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
{ TPINGSend }
TPINGSend = class(TSynaClient)
function Ping(const Host: string): Boolean;
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button_closeClick(Sender: TObject);
begin
Application.Mainform.Close;
end;
procedure TForm1.Button_pingClick(Sender: TObject);
var
PingSend:TPingSend;
ip: string;
begin
Memo1.Clear;
ip:=Edit1.Text;
PingSend:=TPingSend.Create;
Try
PingSend.Timeout :=750;
Memo1.Lines.Append(BoolToStr(PingSend.Ping(ip)));
finally
PingSend.Free;
end;
end;
{ TPINGSend }
function TPINGSend.Ping(const Host: string): Boolean;
begin
end;
end.
When i click the "Ping"-Button, i always get a "0" in Memo1, no matter which Host i enter.
Can anybody help me please?