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" <twsocket@elists.org>
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" <twsocket@elists.org>
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" <twsocket@elists.org>
> 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

Reply via email to