RTC Forums
November 23, 2024, 04:02:49 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1] 2
  Print  
Author Topic: AniIndicator freeze on DataResult as Dataset  (Read 12503 times)
bebeantics
RTC License+
****
Posts: 29


« on: March 23, 2018, 10:15:25 AM »

Hello


I have a small problem with an AniIndicator on Android.
It hangs when I receive a dataset with multiple records.
The reception time is approx. 5-8 seconds.

I can not under any circumstances make the Aniindicator function for the entire duration of the data reception.

on client side i have this request:

  dt.rtcmdsretur.Active:=false;
  dt.rtcmdsretur.Close;
  lwproduseretur.Visible:=false;
  lwproduseretur.Items.Clear;
  text4.Visible:=false;
  aniindicator2.Visible:=true;
  aniindicator2.Enabled:=true;

  with dt.RtcClientModule1 do begin
    data.Clear;

    with data.NewFunction('getretur') do begin

    end;

    try
      call(rtcresult2);
    except
      on e:exception do begin
          showmessage(e.message);
      end;
    end;

  end;

on client side i have this result:
procedure TMainForm.RtcResult2Return(Sender: TRtcConnection; Data,
  Result: TRtcValue);
begin
  if not Sender.inMainThread then
    Sender.Sync(RtcResult2Return, Data, Result)
  else
    begin
        ...
        ...
        else if (Data.isType=rtc_Function) and (Data.asFunction.FunctionName='getretur') then begin

                 if Result.isType = rtc_Dataset then begin

                      dt.rtcmdsretur.asDataSet := Result.asDataSet;
                      Result.Extract;

                      dt.rtcMdsretur.Active := True;
                      lwproduseretur.Visible:=true;

                 end
                 else if result.isType=rtc_exception then
                      showmessage(result.asException);

                 aniindicator2.Enabled:=false;
                 aniindicator2.Visible:=false;
                 text4.Visible:=true;
        end;

    end;
end;

Can someone help me?

[UPDATE]  or somewhere needs to be tested if we have finished receiving the answer ....
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: March 23, 2018, 10:48:04 AM »

If you set AutoConnect:=TRUE and MultiThreaded:=TRUE on the TRtcHttpClient component responsible for handling your requests and you leave AutoSyncEvents:=FALSE (default value) on components linked to that TRtcHttpClient component (for example on the TRtcClientModule component), then all the RTC code responsible for sending and/or receiving data will be executed from background threads (the Main Thread will NOT be used for sending or receiving data), allowing other components to use the Main Thread without interruption while data is being sent and/or received.

NOTE: Setting AutoSyncEvents:=TRUE on any RTC component would result in all events assigned to that component to be synchronized with the Main Thread (the event is posted to the Main Thread and executed there, while the Background Thread waits for the event to finish). This is similar to calling the Sender.Sync() method from inside all events triggered by the RTC component and would therefor execute all events assigned to that component from the Main Thread (instead of background threads), even if you set MultiThreaded:=TRUE on the TRtcHttpClient component.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #2 on: March 23, 2018, 11:08:50 AM »

I change in the rtcclientmodule.autosyncevents:=false;

the problem not solved.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #3 on: March 23, 2018, 11:10:09 AM »

deleted the
if not Sender.inMainThread then
    Sender.Sync(RtcResult2Return, Data, Result)
  else
    begin

from the firs lines of onresulevent to

the problem not solved
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #4 on: March 23, 2018, 11:12:38 AM »

1. How are the other properties on TRtcHttpClient and TRtcClientModule set?

2. Is the Main Thread busy or idle during data transfer? For example, if you place a TMemo or TEdit field on the Main Form, can you use it normally while data is being sent and received, or does the Main Form become unresponsive after using the call method?
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #5 on: March 23, 2018, 11:21:58 AM »

HttpClient. MultiThreaded:=TRUE
httpclient.AutoConnect:=TRUE
httpclient.useproxy:=true

for clientmodule
autorepost:=2
autosyncevent:=false
autosession:=false
hyperthreading:=false
autologin:=false;
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #6 on: March 23, 2018, 11:35:45 AM »

2. Is the Main Thread busy or idle during data transfer? For example, if you place a TMemo or TEdit field on the Main Form, can you use it normally while data is being sent and received, or does the Main Form become unresponsive after using the call method?

The main thread is not unresponsive. I have some buttons, tabcontrols, etc and working under the datareceive event panding
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #7 on: March 23, 2018, 11:40:26 AM »

If other things that require access to the Main Thread are working while data is being sent and/or received, then your problem with "AniIndicator" (or any other component you might be using) is unrelated to the RTC SDK.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #8 on: March 23, 2018, 11:46:52 AM »

If i delete all rtc requests from on click event that call the function from the server side, everything working fine.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #9 on: March 23, 2018, 11:47:41 AM »

I assume that you are using the latest RTC SDK version. If you are using an older RTC SDK version, then I recommend you to download the latest RTC SDK version and update your code if needed (see Updates log files for details).

RTC SDK has been refactored in v9 and some units have been removed in the process. Make sure to unpack the RTC SDK into a new folder when updating and remove eventual paths to old RTC SDK versions, or you could end up mixing units from different RTC SDK versions.

After the update, make sure you are NOT using the "rtcFMX.GUI" or similar units in your Project.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #10 on: March 23, 2018, 11:54:37 AM »

i have v8.14 installed on D10.2.3 version

Updating from a RTC SDK version released before v9.00? Read this topic (v9.00).
Updating from a RTC SDK version released before v8.14? Also read this topic (v8.14).

I use de first or the second topic ?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #11 on: March 23, 2018, 12:01:22 PM »

You only need to read update logs for versions released AFTER the version you are currently using. So ... if you have already updated to RTC SDK v8.14 before, assuming that you have read the updates log for that version, you only need to read update logs for versions released after that. In your case, this includes all update logs for RTC SDK v8.15 and later versions, but the absolute MUST READ is RTC SDK v9.0 - which includes important notes about refactoring.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #12 on: March 23, 2018, 12:15:18 PM »

where i can read about the properties/functions/procedure in what units are?

i have a Write_File undeclared identifier now, but I do not want to bother you with these issues
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #13 on: March 23, 2018, 12:25:10 PM »

Because most utility classes and functions were moved from other units to the "rtcSystem" unit, adding the "rtcSystem" unit to the "uses" list should fix most compile errors about "undeclared" RTC functions or classes. You can read more about this in the RTC SDK v9.0 updates log.
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #14 on: March 23, 2018, 12:46:58 PM »


the initial problem still persists
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.03 seconds with 17 queries.