Hello Jack, > the first string in both cases. So it shouldn't be the server > sending the string twice.
No but you close the connection. When you close TWSocket will empty his receiving buffer if there is yet still data in it. So I think that is what happening. --- Rgds, Wilfried http://www.mestdagh.biz Thursday, May 19, 2005, 00:35, Jack wrote: > Hello Wilfried, > Sure. Below is my event handler code. Hope I'm doing something > wrong, otherwise, it's really strange. TProxyChecker is the owner > object of the TProxySocket object array. TProxySocket is derived > from TWSocket. > procedure TProxyChecker.WSocketDataAvailable(Sender: TObject; ErrCode: Word); > var s: String; > begin > if ErrCode = 0 then > with TProxySocket(Sender) do > begin > s := ReceiveStr(); > Log(s); > Close(); > end; > end; > The destination server is a commercial http proxy server. > I tried using #13#10 and #13#10#13#10, I different strings > read back from ReceiveStr. But the second string includes > the first string in both cases. So it shouldn't be the server > sending the string twice. > BTW, I'm using the latest ICS. > -- > Best regards, > Jack > Wednesday, May 18, 2005, 3:31:32 PM, you wrote: WM>> Hello Jack, WM>> Can you show your OnDataAvailable handler ? WM>> Eventually download SocketSpy from 'user made' page and 'hang' it WM>> between client and server. Then you see exacly what is sent by server. WM>> --- WM>> Rgds, Wilfried WM>> http://www.mestdagh.biz WM>> Wednesday, May 18, 2005, 20:48, Jack wrote: >>> Hello Francois and all, >>> I'm using a TWSocket client in LineMode with LineEnd set to #13#10. >>> I connect to a HTTP proxy server using CONNECT command. I then get >>> a reply back from the HTTP proxy from ReceiveStr() >>> Things look OK except that I am receiving the data from the first >>> ReceiveStr() call twice. I get two WSocketDataAvailable messages for >>> 3 lines in the HTTP response: >>> Line 1: HTTP/1.0 200 Connection established >>> Line 2: Proxy-agent: Proxy+ 3.00 >>> Line 3: (Blank line) >>> However, I'm getting the first ReceiveStr() result twice, see below: >>> I'm getting "HTTP/1.0 200 Connection established" twice: >>> 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 >>> ErrCode=0 >>> 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established >>> 5/18/2005 2:36:43 PM >>> 5/18/2005 2:36:43 PM >>> 5/18/2005 2:36:43 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 >>> ErrCode=0 >>> 5/18/2005 2:36:43 PM HTTP/1.0 200 Connection established >>> Proxy-agent: Proxy+ 3.00 >>> I then changed LineEnd to #13#10#13#10, I still get the result of >>> the first ReceiveStr() twice, this time the result is two lines: >>> HTTP/1.0 200 Connection established >>> Proxy-agent: Proxy+ 3.00 >>> (Blank line) >>> 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 >>> ErrCode=0 >>> 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established >>> Proxy-agent: Proxy+ 3.00 >>> 5/18/2005 2:40:11 PM >>> 5/18/2005 2:40:11 PM >>> 5/18/2005 2:40:11 PM WSocketDataAvailable idx=0 addr=127.0.0.1:4480 >>> ErrCode=0 >>> 5/18/2005 2:40:11 PM HTTP/1.0 200 Connection established >>> Proxy-agent: Proxy+ 3.00 >>> It seems that, somehow the first ReceiveStr() didn't remove the data >>> from the buffer. Or am I missing anything? >>> -- >>> Best regards, >>> Jack -- 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