procedure Tw_main.IdTCPServer1Execute(AThread: TIdPeerThread);
var
  Rev:array[1..1024] of char;
begin
  if not AThread.Terminated and AThread.Connection.Connected then
  begin
    AThread.Connection.ReadBuffer(Rev,4);
    if Rev='Q001' then   //---不行
    begin
      AThread.Connection.ReadBuffer(Rev,103 - 4);
      Memo1.Lines.Add(Rev);
    end;
  end;
end;接收前4个字符进行判断,然后根据条件接收后面的