Re: [twsocket] Problem changing LineEnd before full buffer reading
Hello, OK not a big deal now I know it's a bug and not a bad usage on my side, I can manage it. Thanx. >> I am in front of a strange behavior and would like to know if it is >> because of a misuse or a bug (using ICS V8 WSocket) >> R> Probably a bug in the unit OverbyteIcsWSocket? R> function TCustomLineWSocket.TriggerDataAvailable(ErrCode : Word) : Boolean; R> ... R> else begin R> Move(PAnsiChar(FRcvdPtr)[I + Length(FLineEnd)], R> PAnsiChar(FRcvdPtr)[0], R> FRcvdCnt - I - Length(FLineEnd)); R> FRcvdCnt := FRcvdCnt - I - Length(FLineEnd); R> end; R> This code is moving the not yet processed data to the beginning of the R> buffer, so it can search for the next line in the remaining received R> data, after triggering the client OnDataAvailable (for the current found R> line) where you change the FLineEnd, so, if the FLineEnd length changes, R> it picks the wrong already processed data end. mailto:do...@yahoo.com -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] Problem changing LineEnd before full buffer reading
I am in front of a strange behavior and would like to know if it is because of a misuse or a bug (using ICS V8 WSocket) Probably a bug in the unit OverbyteIcsWSocket? function TCustomLineWSocket.TriggerDataAvailable(ErrCode : Word) : Boolean; ... else begin Move(PAnsiChar(FRcvdPtr)[I + Length(FLineEnd)], PAnsiChar(FRcvdPtr)[0], FRcvdCnt - I - Length(FLineEnd)); FRcvdCnt := FRcvdCnt - I - Length(FLineEnd); end; This code is moving the not yet processed data to the beginning of the buffer, so it can search for the next line in the remaining received data, after triggering the client OnDataAvailable (for the current found line) where you change the FLineEnd, so, if the FLineEnd length changes, it picks the wrong already processed data end. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] Problem changing LineEnd before full buffer reading
Hello, I am in front of a strange behavior and would like to know if it is because of a misuse or a bug (using ICS V8 WSocket) I am inside a TWebSocket.OnDataAvailable with LineEnd set to CRLF (two chars). I received a data packet containing many lines, the first lines are standard CRLF lines and then there is no more CRLF separator "{}" blocks so I decided to switch LineEnd for a "}" single char. Example of buffer : Line1$0D$0A Line2$0D$0A Line3$0D$0A {hello1 1234567}{hello2 1234567}{hello3 1234567} In this example I let OnDataAvailable trigger 3 times then I set LineEnd to '}'. The next OnDataAvailable will trigger fine but will retrieve an extra char from the last char of previous buffer, then next lines are retrieved fine, no more extra char : "Line1$0D$0A" "Line2$0D$0A" "Line3$0D$0A" "$0A{hello1 1234567}" "{hello2 1234567}" "{hello3 1234567}" In this example the "}" lines ended also with a "7" so I decided to change LineEnd to "7}" (same char length as a CRLF) that fixed the problem, no more extra char in the first new LineEnd (by curiosity I tried to set a larger LineEnd "67}" but it worked fine so the problem seems to appear only if LineEnd is changed to shorter char length. regards. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be