Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Dec : Re: TIdTCPClient.Connect(Timeout not working)

www.cryer.info
Managed Newsgroup Archive

Re: TIdTCPClient.Connect(Timeout not working)

Subject:Re: TIdTCPClient.Connect(Timeout not working)
Posted by:"Jamie Dale" (jamie.da..@yahoo.com)
Date:Sun, 2 Dec 2007 23:55:23

I just thought, I should mention that I was testing the timeout by trying to
connect to a non-existent server address...

Didn't work though :(

JD

"Jamie Dale" <jamie.dale@yahoo.com> wrote in message
news:47534511@newsgroups.borland.com...
> 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

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive