delphi ping问题socket error #11004(50分)

  • 主题发起人 主题发起人 formiss
  • 开始时间 开始时间
F

formiss

Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;

interface

uses
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);
procedure IdIcmpClient1Reply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
aBuffer: string;
begin
// IdIcmpClient1.Ping();
IdIcmpClient1.Host := 'http://www.every.com.cn';
// IdIcmpClient1.TTL := 64;
IdIcmpClient1.ReceiveTimeout := 1000;
try
IdIcmpClient1.Ping;
except on e:exception do
showMessage('false'+ e.Message );//报错: socket error #11004
end;

// showMessage(aBuffer);
// showMessage(IdIcmpClient1.ReplyData);
end;

procedure TForm1.IdIcmpClient1Reply(ASender: TComponent;
const AReplyStatus: TReplyStatus);
var
sTime: string;
begin
try
if AReplyStatus.ReplyStatusType = rsError then
showMessage('false rsError')
else
showMessage('true');
except
showMessage('false except');
end;
end;

end.
 
实现PING链接的问题! (50分)
分类:Internet/TCPIP(Delphi)flyso(2003-01-25 17:55)
张无忌(2003-01-25 18:28)
你把showmessage改成messageBox(0,'nihao','nihao ',MB_OK);

flyso(2003-01-26 13:49)
接受答案了.


张无忌的回答最终被接受。

问问题前先查找一下比较好。[:)]
 
调试时候是会出现问题的啊!
 
谢谢各位。已经解决了。
原来是在ping的时候,url中不能写http://
 
后退
顶部