Q
qby
Unregistered / Unconfirmed
GUEST, unregistred user!
我用Indy的TIdDNSResolver解析一个邮箱域名,如:163.com。想得到它的 MX 记录。
用了两种方法:
方法1:在TForm上放一个TButton, 再拖放一个TIdDNSResolver,
然后设置TIdDNSResolver的属性为:
Active := False;
Host := '61.139.2.69';
Port := 53;
ReceiveTimeout := 1000;
BufferSize := 8192;
BroadcastEnabled := False;
AllowRecursiveQueries := True;
QueryRecords := [qtMX];
然后:
procedure TForm1.Button5Click(Sender: TObject);
begin
IdDNSResolver1.Active := True;
IdDNSResolver1.Resolve('163.com');
......
end;
方法2:TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
......
private
{ Private declarations }
FDNSResolver: TIdDNSResolver;
public
{ Public declarations }
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FDNSResolver := TIdDNSResolver.Create(nil);
try
with FDNSResolver do begin
Host := '61.139.2.69';
Port := 53;
ReceiveTimeout := 1000;
AllowRecursiveQueries := True;
QueryRecords := [qtMX];
Active := True;
Resolve('163.com');
end;
finally
FDNSResolver.Free;
end;
end;
另人感到异常奇怪的是:方法1每次都能够很好地完成工作,并正确地解析出'163.com'。
但方法2在执行到 Resolve('163.com'); 一行时,则有时正确、有时出错,错误为
TimedOut错误。方法1和方法2的ReceiveTimeout都是1000,为何方法1不会出现错误呢?
且这两种方法我认为应该是完全相同的。但为何出现两种情况呢?本人进行了无数次的实验,结果均如此。
我的平台是:win2000(中文)、delphi6.0(Build 6.240、update Pack 2)、Indy 9.0
各位老大,救救我吧!200分送上,不够还有!!!!!!!!
用了两种方法:
方法1:在TForm上放一个TButton, 再拖放一个TIdDNSResolver,
然后设置TIdDNSResolver的属性为:
Active := False;
Host := '61.139.2.69';
Port := 53;
ReceiveTimeout := 1000;
BufferSize := 8192;
BroadcastEnabled := False;
AllowRecursiveQueries := True;
QueryRecords := [qtMX];
然后:
procedure TForm1.Button5Click(Sender: TObject);
begin
IdDNSResolver1.Active := True;
IdDNSResolver1.Resolve('163.com');
......
end;
方法2:TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
......
private
{ Private declarations }
FDNSResolver: TIdDNSResolver;
public
{ Public declarations }
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FDNSResolver := TIdDNSResolver.Create(nil);
try
with FDNSResolver do begin
Host := '61.139.2.69';
Port := 53;
ReceiveTimeout := 1000;
AllowRecursiveQueries := True;
QueryRecords := [qtMX];
Active := True;
Resolve('163.com');
end;
finally
FDNSResolver.Free;
end;
end;
另人感到异常奇怪的是:方法1每次都能够很好地完成工作,并正确地解析出'163.com'。
但方法2在执行到 Resolve('163.com'); 一行时,则有时正确、有时出错,错误为
TimedOut错误。方法1和方法2的ReceiveTimeout都是1000,为何方法1不会出现错误呢?
且这两种方法我认为应该是完全相同的。但为何出现两种情况呢?本人进行了无数次的实验,结果均如此。
我的平台是:win2000(中文)、delphi6.0(Build 6.240、update Pack 2)、Indy 9.0
各位老大,救救我吧!200分送上,不够还有!!!!!!!!