> Arno Garrels [TeamICS] wrote:
>Have a look at this demo, if you think it's usefull I can add it to the
>repository.

Oh, I am looking at this and get myself full of questions. Server app is rather 
clear, but not the Client, it's quite complex.

1) What's the meainng of SendBinString in Server, it is never used? What for do 
you use PutDataInSendBuffer?
2) I see alot of code to implement a data buffer which imho does the same 
things that socket buffer do. Isn't it necessary to construct such 
sophisticated logic every time when data parsing is needed?
Moreover (maybe I haven't detected) what do you do, if FRcvBuf is going to be 
filled? That is,

FRcvBuf: [_] [_] [_] [_] [D] [D] [D]
                          |
[_] - already parsed data
[D] - data to be parsed
| - current pointer

and there are some more bytes to be received, but buffer is over... I've found 
only one Move(), but it's located inside if FReceiveMode = rmLine section, but 
no copying is done when mode is binary.

Maybe it would be a good idea to implement this buffer internally in TWSocket? 
Just to have a solid way to know how mush data is available now.

3)  if FReceiveMode = rmLine then
    begin
      ...
    end;
    
    if FReceiveMode <> rmBinary then
        Exit;

strange construction, concerning that FReceiveMode could be only rmLine or 
rmBinary... maybe if..else ?

4)  while (Length(RcvdLine) > 0) and
              (RcvdLine[Length(RcvdLine)] in [#13, #10]) do
            RcvdLine := Copy(RcvdLine, 1, Length(RcvdLine) - 1);

    while (Length(RcvdLine) > 0) and
              (RcvdLine[Length(RcvdLine)] in [#13, #10]) do
            SetLength(RcvdLine, Length(RcvdLine) - 1); ?

--
Best regards, Anton
-- 
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

Reply via email to