----- Original Message -----
From: "Arno Garrels" <[EMAIL PROTECTED]>
To: "ICS support mailing" <[email protected]>
Sent: Thursday, February 01, 2007 2:19 PM
Subject: Re: [twsocket] THttpMTServer problem with Dup
>
>> Client.Dup(NewHSocket); // SOMETIMES WHEN HIGH LOAD IS IN PLACE, THIS
>> FUNCTION MAKES CLIENT.HSOCKET = -1 AND RAISES THE EXCEPTION "LIST ITEM
>> OUT
>> OF INDEX"
>
> I don't know this exception message, do you mean "List index out of
> bounds()"?
Yes, exactly.
>
> According to procedure Dup, the component state does not seem to be
> wsClosed.
>
> procedure TCustomWSocket.Dup(NewHSocket : TSocket);
> var
> iStatus : Integer;
> optlen : Integer;
> begin
> ..
> if FState <> wsClosed then begin
> iStatus := WSocket_Synchronized_closesocket(FHSocket);
> FHSocket := INVALID_SOCKET;
> if iStatus <> 0 then begin
> SocketError('Dup (closesocket)');
> Exit;
> end;
>
> ChangeState(wsClosed);
> end;
> FHsocket := NewHSocket;
> ..
>
> ---
> Arno Garrels [TeamICS]
> http://www.overbyte.be/eng/overbyte/teamics.html
>
>
>
> Fastream Technologies wrote:
>> Hello,
>>
>> I have the following function called from worker thread context
>> (NewHSocket passed with a message):
>>
>> function TCustomWSocketMTServer.AfterClientCreated(
>> Client : TWSocketMTClient; Error: Word; NewHSocket: integer) :
>> boolean; var
>> currentClientCount: integer;
>> currentMaxClients: integer;
>> begin
>> Result := TRUE;
>>
>> FCriticalSection.Enter;
>> Inc(FClientNum);
>> Client.Name := Name + 'Client' + IntToStr(FClientNum);
>> FClientList.Add(Client);
>> currentClientCount := FClientList.Count;
>> Client.Banner := FBanner;
>> Client.Server := Self;
>> currentMaxClients := FMaxClients;
>> FCriticalSection.Leave;
>>
>> {$IFNDEF NO_DEBUG_LOG}
>> Client.IcsLogger := IcsLogger; {
>> V5.04 } {$ENDIF}
>>
>> Client.Dup(NewHSocket); // SOMETIMES WHEN HIGH LOAD IS IN PLACE,
>> THIS FUNCTION MAKES CLIENT.HSOCKET = -1 AND RAISES THE EXCEPTION
>> "LIST ITEM OUT OF INDEX"
>> Client.OnDataSent := nil;
>>
>> TriggerClientConnect(Client, Error);
>>
>> { Ok, the client is still there, process with the connection }
>> if (currentMaxClients > 0) and (currentClientCount >
>> currentMaxClients) then begin
>> { Sorry, too much clients }
>> Client.Banner := BannerTooBusy;
>> Client.OnDataAvailable := nil; // should be set previously in
>> initClient for non-503
>> Client.StartConnection;
>> Client.CloseDelayed;
>>
>> Result := false;
>> end;
>> end;
>>
>> Any idea?
>>
>> Best Regards,
>>
>> SZ
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be