Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Improve performance for DataSnap Client/Server for Mobile-PC


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Luis Concepcion

Posts: 16
Registered: 3/16/00
Improve performance for DataSnap Client/Server for Mobile-PC  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 13, 2015 9:55 AM
Hi!

I have developed a datasnap client (mobile) app which connects to a datasnap server (desktop) application. It works fine, but I need any advice to improve performance.
I'm using Delphi 10 Seattle.

This is what I do to connect to server and retrieve some records (client app):


    try
          DSProviderConnection1.Connected:=true;
    except
    end;
 
    if DSProviderConnection1.Connected=false then
    begin
        showmessage('Couldn't connect to '+hostip);
        exit;
    end;
 
    resp:=TDSServerModule_EMPLOYEEClient.Create(SQLConnection1.DBXConnection);
 
    if resp.SetConnection(hostip,database,passwd) then
    begin
        ClientDataSet2.Close;
        ClientDataSet2.CommandText:='select * from customers';
        ClientDataSet2.Open;
 
        while not ClientDataSet2.EOF do
        begin
            // create custom item
            Item := TListBoxItem.Create(nil);
            Item.Parent := ListBox1;
            Item.StyleLookup := 'customerstyle';
            Item.StylesData['name'] := ClientDataSet2.FieldByName('NAME').AsString;
            Item.StylesData['surname'] := ClientDataSet2.FieldByName('SURNAME').AsString;
            Item.StylesData['code'] := ClientDataSet2.FieldByName('CODE').AsString;
 
            ClientDataSet2.Next;
            application.ProcessMessages;
        end;
    end
    else
        showmessage(Connection established, but something happened trying to retrieve records...');
 
    resp.Free;
 


I'm using a while statement to retrieve records, some application.processmessages to avoid freeze effect, and trying to detect posible connection errors , but... Is this the best method to achieve this?

Sometimes the desktop server application freezes and I can't make new connections from client until I restart it. Is it posible to completely unload/free/disconnect everything if something goes wrong?

Thanks!

Edited by: Luis Concepcion on Oct 13, 2015 9:55 AM

Edited by: Luis Concepcion on Oct 14, 2015 1:19 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02