----- Original Message ----- 
From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "Fastream Technologies" <[EMAIL PROTECTED]>
Sent: Sunday, October 09, 2005 6:33 PM
Subject: Re: [twsocket] Sync THttpConnection derivative


> Wrong address.
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
> ----- Original Message ----- 
> From: "Fastream Technologies" <[EMAIL PROTECTED]>
> To: "Francois PIETTE" <[EMAIL PROTECTED]>
> Sent: Sunday, October 09, 2005 4:46 PM
> Subject: Re: [twsocket] Sync THttpConnection derivative
>
>
>> Ok, let's try the old failed Sync style:
>>
>> function TWebConnection.SendSync(Data: PChar; DataLen: Integer): integer;
>> var
>>    lCount    : {$IFDEF FPC} LongWord; {$ELSE} LongInt; {$ENDIF}
>> begin
>>        if FTerminated or
>>        ((State <> wsConnected) and (State <> wsSocksConnected)) then
>>        begin
>>                Result := 0;
>>                Exit;
>>        end;
>>
>>        OldDataAvailable := FOnDataAvailable;
>>        OldSendData := FOnSendData;
>>        OldDataSent := FOnDataSent;
>>
>>        FOnDataAvailable := nil;
>>        FOnSendData := nil;
>>        FOnDataSent := nil;
>>
>>        Pause();
>>
>>        WSocket_ioctlsocket(HSocket, ???, lCount); // What should be the 
>> parameters here?
>>        Result := WSocket_Send(HSocket, Data, DataLen, 0);
>>
>>        if FTerminated or
>>        ((State <> wsConnected) and (State <> wsSocksConnected)) then
>>        begin
>>                Result := 0;
>>                Exit;
>>        end;
>>
>>        Resume();
>>
>>        FOnDataAvailable := OldDataAvailable;
>>        FOnSendData := OldSendData;
>>        FOnDataSent := OldDataSent;
>>
>> This logic will be the best is now what's on my mind as on long ISAPI 
>> scripts, it gets too long to buffer... Could you help?
>>
>> Best Regards,
>>
>> SZ
>>
>> ----- Original Message ----- 
>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <[email protected]>
>> Sent: Sunday, October 09, 2005 1:16 PM
>> Subject: Re: [twsocket] Sync THttpConnection derivative
>>
>>
>> The datalen is valid! I tried to pass data from Delphi code to C++ and of
>> PChar, TStream and string, only string was successful. Let me elaborate:
>>
>> There is the THttpConnection derivative TWebConnection and the class
>> httpServerClientClass derives from that. Now in this class, I call
>> DXISAPI->Execute and pass "this". In DXISAPI, I call TWebConnection:
>>
>> function TWebConnection.SendSync(Data: PChar; DataLen: Integer): integer;
>> begin
>>        if FTerminated then
>>        begin
>>                Result := 0;
>>                Exit;
>>        end;
>>
>>        if Assigned(ISAPIResponsePtr) then
>>                ReallocMem(ISAPIResponsePtr, ISAPIResponseLen + DataLen)
>>        else
>>                GetMem(ISAPIResponsePtr, DataLen);
>>
>>        Move(Data, ISAPIResponsePtr[ISAPIResponseLen], DataLen);
>>        ISAPIResponseLen := ISAPIResponseLen + DataLen;
>> end;
>>
>> The data here is valid but when DXISAPI->Execute() returns, it gets
>> garbage!!!
>>
>> Best Regards,
>>
>> SZ
>>
>> ----- Original Message ----- 
>> From: "Francois PIETTE" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <[email protected]>
>> Sent: Thursday, October 06, 2005 7:40 PM
>> Subject: Re: [twsocket] Sync THttpConnection derivative
>>
>>
>>> Any other idea?
>>
>> See issue #2 in my message. Put a breakpoint to be sure.
>>
>> --
>> [EMAIL PROTECTED]
>> http://www.overbyte.be
>>
>>
>> ----- Original Message ----- 
>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>> To: "ICS support mailing" <[email protected]>
>> Sent: Thursday, October 06, 2005 2:21 PM
>> Subject: Re: [twsocket] Sync THttpConnection derivative
>>
>>
>>>I used the Pause() and Resume as well as the Flush to flush the internal
>>> buffer but have had no luck!
>>>
>>> Any other idea?
>>>
>>> Best Regards,
>>>
>>> SubZ
>>>
>>> ----- Original Message ----- 
>>> From: "Francois Piette" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" <[email protected]>
>>> Sent: Thursday, October 06, 2005 2:51 PM
>>> Subject: Re: [twsocket] Sync THttpConnection derivative
>>>
>>>
>>> 1) When you pause the socket, are you sure the internal buffer has been
>>> emptyed ? You get OnDataSent
>>> event each time the internal buffer has been emptyed.
>>>
>>> 2) MessageBox will show your data until the first nul byte whatever
>>> DataLen
>>> is. This means if your
>>> DataLen argument is wrong, you don't see it and nevertheless, you send
>>> garbage (WSocket_send use the
>>> length argument).
>>>
>>> --
>>> Contribute to the SSL Effort. Visit
>>> http://www.overbyte.be/eng/ssl.html
>>> --
>>> [EMAIL PROTECTED]
>>> Author of ICS (Internet Component Suite, freeware)
>>> Author of MidWare (Multi-tier framework, freeware)
>>> http://www.overbyte.be
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>>> To: "ICS support mailing" <[email protected]>
>>> Sent: Thursday, October 06, 2005 10:01 AM
>>> Subject: Re: [twsocket] Sync THttpConnection derivative
>>>
>>>
>>>> Hi All!
>>>>
>>>> Per Francois' private reply, I coded the following for my problem:
>>>>
>>>> function TWebConnection.SendSync(Data: PChar; DataLen: Integer): 
>>>> integer;
>>>> begin
>>>>         MessageBox(0, Data, Data, MB_OK); // for debug
>>>>
>>>>         Pause();
>>>>
>>>>         Result := WSocket_send(HSocket,
>>>>                     Data,
>>>>                     DataLen,
>>>>                     0);
>>>>
>>>>         Resume();
>>>> end;
>>>>
>>>> Now, even though the MessageBox shows the correct ASCII/HTML data with
>>>> header, the socket shows garbage with SocketSpy:
>>>>
>>>> 06.10.2005 10:54:14 Connection Opened
>>>>
>>>> 06.10.2005 10:54:14 From Local
>>>>
>>>> GET /index.php HTTP/1.1..Host: localhost:81..User-Agent: Mozilla/5.0
>>>> (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511
>>>> Firefox/1.0.4..Accept:
>>>>
>>> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5.
>>> .Accept-Language:
>>>> en-us,en;q=0.5..Accept-Encoding: gzip,deflate..Accept-Charset:
>>>> ISO-8859-1,utf-8;q=0.7,*;q=0.7..Keep-Alive: 300..Connection:
>>>> keep-alive..Referer: http://localhost:81/....
>>>>
>>>> 06.10.2005 10:54:21 From Remote
>>>>
>>>>
>>> °S»...¹..à..Dæ..Dë..İæ...à..øü!."[½.................................................................
>>> ........°S».`1».....o1».Ê.
>>>>
>>>> Any idea why this happens?
>>>>
>>>> Best Regards,
>>>>
>>>> SubZ
>>>>
>>>> ----- Original Message ----- 
>>>> From: "Fastream Technologies" <[EMAIL PROTECTED]>
>>>> To: "ICS support mailing" <[email protected]>
>>>> Sent: Wednesday, October 05, 2005 3:46 PM
>>>> Subject: [twsocket] Sync THttpConnection derivative
>>>>
>>>>
>>>> > Hello,
>>>> >
>>>> > I know most of you are very inclined to say that "sync is no good!" 
>>>> > but
>>>> > it
>>>> > is not that simple. I have licensed code from BPDX.com for ISAPI and
>>>> > ISAPI
>>>> > filters andt hese units (more than 100k!) need to read, write and 
>>>> > alter
>>>> > header or an existing THttpConnection derivative class. Starting with
>>>> > writing, I wrote the below function:
>>>> >
>>>> > function TWebConnection.SendSync(Data: PChar; DataLen: Integer):
>>>> > integer;
>>>> > var
>>>> >        Count: integer;
>>>> > begin
>>>> >        if FTerminated then
>>>> >        begin
>>>> >                Result := 0;
>>>> >                Exit;
>>>> >        end;
>>>> >
>>>> >        fDataLen := DataLen;
>>>> >        fTotalSentDataLen := 0;
>>>> >        //OldDataAvailable := FOnDataAvailable;
>>>> >        //OldSendData := FOnSendData;
>>>> >        //OldDataSent := FOnDataSent;
>>>> >        FOnDataAvailable := InternalDataAvailable;
>>>> >        FOnSendData := ConnectionSendDataISAPI;
>>>> >        FOnDataSent := nil;
>>>> >        DoneFlag := false;
>>>> >
>>>> >        ISAPIDownloadPauseDelay;
>>>> >
>>>> >        Count := Send(Data, DataLen);
>>>> >        Result := Count;
>>>> >
>>>> >        if (Result = 0) or FTerminated then
>>>> >        begin
>>>> >                Result := 0;
>>>> >                Exit;
>>>> >        end;
>>>> >
>>>> >        if WaitUntilReady(DoneFlag) <> 0 then
>>>> >                Result := 0
>>>> >        else
>>>> >        begin
>>>> >                DataSent := DataSent + Count;
>>>> >                FOnDataAvailable := nil;
>>>> >                FOnSendData := nil;
>>>> >                FOnDataSent := nil;
>>>> >        end;
>>>> > end;
>>>> >
>>>> > InternalDataAvailable, and WaitUntilReady are the same as Francois'.
>>>> >
>>>> > procedure TWebConnection.ConnectionSendDataISAPI(Sender: TObject;
>>>> > BytesSent:
>>>> > Integer);
>>>> > begin
>>>> >        fTotalSentDataLen := fTotalSentDataLen + BytesSent;
>>>> >
>>>> >        if fTotalSentDataLen >= fDataLen then
>>>> >                DoneFlag := true;
>>>> > end;
>>>> >
>>>> > So far so good but when I launch many client threads to the
>>>> > PHP5ISAPI.dll
>>>> > script, in a few seconds it gives access violation in kernel32.dll! I
>>>> > think
>>>> > considering also the logic of ISAPI filters, we still need sync
>>>> > functions
>>>> > in
>>>> > parallel. Do you see the bug above?
>>>> >
>>>> > Regards,
>>>> >
>>>> > SubZ
>>>> >
>>>> > -- 
>>>> > 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
>>>
>>> -- 
>>> 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
>>
>> -- 
>> 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
> 

-- 
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

Reply via email to