Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Nov : TIdTcpClient
| Subject: | TIdTcpClient |
| Posted by: | "CtrlAltDel" (aie..@usenet.net) |
| Date: | Sun, 5 Nov 2006 14:11:55 |
History:
I had Putty pre-configured to log on to my dedicated server. I just
recently re-formatted my laptop and Putty's SSH configuration was lost
in the process.
Furthermore I have forgotten what port I changed SSH to listen to.
Plan:
Write a simple application to scan ports on my dedicated server to
find out which port I had set it to listen to.
Implementation:
Main App->Spawn Thread->Scan ports
procedure PrtScn.Execute;
var
t: TIdTcpClient;
I: integer;
begin
for I := 20000 to 30000 - 1 do
begin
Prt := I;
Synchronize(UpdateStatus);
t := TIdTcpClient.Create();
t.Host := 'myIP';
t.ConnectTimeout := 1000;
t.Port := Prt;
try
t.Connect;
except on E: Exception do
//nothing
end;
if (t.Connected) then
Synchronize(UpdateMemo);
t.Free;
end;
end;
This is working, I think...but with a connectiontimeout at 1000 ms
it's not only slow, but for some reason it chokes every now and then,
but it continues after 30 seconds or so...
How can I speed up the process? The reason I set 20K->30K in the for
loop is because I'm pretty sure it was within that range.
Cheers!