Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : TIdTCPClient.Connect(Timeout not working)
| Subject: | TIdTCPClient.Connect(Timeout not working) |
| Posted by: | "Jamie Dale" (jamie.da..@yahoo.com) |
| Date: | Sun, 2 Dec 2007 23:51:45 |
Hi
Indy v9...
TIdTCPClient.Connect's timeout doesn't seem to work!
I've narrowed it down to one annoying little area:
procedure TIdConnectThread.Execute;
begin
try
// Id_WSAEBADF (9) on Linux, Id_WSAENOTSOCK (10038) on Windows
GStack.CheckForSocketError(FBinding.Connect, [Id_WSAEBADF,
Id_WSAENOTSOCK]);
except on
E: Exception do begin
FExceptionMessage := E.Message;
if E is EIdSocketError then begin
FLastSocketError := EIdSocketError(E).LastError;
end;
end;
end;
// Necessary as caller checks this
Terminate;
end;
Why 'Terminate' here?
Then in IdIOHandlerSocket:
if Terminated then begin
ATimeout := 0;
Break;
end;
It seems that for some reason, the connect thread is terminated prematurely
which nulls any connection timeout.
Why is the timeout there included if it is cancelled? - Or am I
misunderstanding it's purpose? (if I am, please explain!)
Thx
JD