procedure TForm1.FormCreate( Sender : TObject );
begin
IdTCPClient1.Host := ’127.0.0.1’;
IdTCPClient1.Port := 80;
IdTCPClient1.Connect;
try
IdTCPClient1.SendCmd(’GET /default.htm’ );
Memo1.Lines.Add( IdTCPClient1.CurrentReadBuffer );
finally
IdTCPClient1.Disconnect;
end;
end;
其中SendCmd 方法向进行响应的服务器发送合适的字符串。