Re: stuck in TIdStackWindows.WSSelect

Giganews Newsgroups
Subject: Re: stuck in TIdStackWindows.WSSelect
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Mon, 2 Aug 2004

"Mark Di Nicola" <f…@bar.com> wrote in message
news:4DF38ED320A7E240f…@bar.com...

> if i follow back the call stack i can see that all those functions are
> using IdTimeoutDefault so i would have though that in WSSelect it runs
>
> Result := Select(0, @FDRead, @FDWrite, @FDError, @tmTO);

You assume incorrectly.  It executes this line instead:

    Result := Select(0, @FDRead, @FDWrite, @FDError, nil);

> and i can't see anywhere where IdTimeoutDefault is set to
> IdTimeoutInifinite.

IdTimeoutDefault is not set to IdTimeoutInfinite.  IdTimeoutDefault is a
flag that is used to set ATimeout to IdTimeoutInfinite instead.  In this
case, it is happening inside of ReadFromStack():

    function TIdTCPConnection.ReadFromStack(const
ARaiseExceptionIfDisconnected: Boolean = True; ATimeout: Integer =
IdTimeoutDefault; const ARaiseExceptionOnTimeout: Boolean = True): Integer;
    begin
        if ATimeout = IdTimeoutDefault then begin
            if ReadTimeOut = 0 then begin    // <-- set to 0 by default
                ATimeout := IdTimeoutInfinite;    // <-- set to infinite
waiting here
            end else begin
                ATimeout := FReadTimeout;
            end;
        end;
        //...
        if IOHandler.Readable(ATimeout) then begin
        //...
    end;

ReadLn() calls ReadFromStack() with ATimeout=IdTimeoutDefault because
ReceiveHeader() calls ReadLn() with ATimeout=IdTimeoutDefault.

> is all this likely to be caused by me stuffing something up royally or
> is entirely possible its a simple problem? any ideas on where to start
> looking?

The only way for your code to freeze the way you are suggesting is if the
POP3 server itself is not sending any data to begin with when TIdPOP3
expects it to, thus WSSelect() does not break from its infinite waiting
while waiting for the socket to become signalled.

> i'm running bcb6 update 4

Are you using Indy 8 or 9?  BCB6 ships with Indy 8, which is a very old
version that is no longer supported.

Gambit

Replies

In response to

stuck in TIdStackWindows.WSSelect posted by Mark Di Nicola on Mon, 02 Aug 2004