#1 2013-02-10 18:39:44

ManUn
Member
Registered: 2013-02-04
Posts: 22

Compress data

How can we compress data transmited between TSQLHttpserver and THttpclient?

Offline

#2 2013-02-10 18:57:48

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Compress data

You can call the RegisterCompress() method on both client and server sides, to use either ZIP (zlib/deflate/gzip), either our SynLZ compression.

Offline

#3 2013-02-13 11:23:33

ManUn
Member
Registered: 2013-02-04
Posts: 22

Re: Compress data

Is there any example using RegisterCompress?

In the server I found this method all right, but in TSQLHttpClient I didn't find it.

Offline

#4 2013-02-14 17:53:10

ManUn
Member
Registered: 2013-02-04
Posts: 22

Re: Compress data

Can someone help me?

Last edited by ManUn (2013-02-14 17:53:28)

Offline

#5 2013-02-16 17:37:02

Niko
Member
Registered: 2013-02-16
Posts: 5

Re: Compress data

Hi, I'm new in this forum.

How did you solve you problem?
Because I'm having the same problem.

Offline

#6 2013-02-16 17:50:52

ManUn
Member
Registered: 2013-02-04
Posts: 22

Re: Compress data

No...

Offline

#7 2013-02-17 15:22:45

Niko
Member
Registered: 2013-02-16
Posts: 5

Re: Compress data

Ab, Is the data compress by default?

If I use on the server side:

{$define COMPRESSSYNLZ}
  FServer := TSQLHttpServer.Create('8988', DB);

and on the client side:

{$define COMPRESSSYNLZ}
  FHttp := TSQLHttpClient.Create(Servidor, '8988', FModel);

Does this code enable the compression?

Offline

#8 2013-02-17 16:22:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Compress data

The conditional shall be defined at Project level, not before calling Create.

{$define COMPRESSSYNLZ} here won't affect the code in implementation unit.

Offline

#9 2013-02-17 16:58:05

Niko
Member
Registered: 2013-02-16
Posts: 5

Re: Compress data

Do You mean in the source of the project like this?

{$R *.res}
{$define COMPRESSSYNLZ}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TfrmServer, frmServer);
  Application.Run;
end.

Offline

#10 2013-02-17 18:07:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Compress data

No, in the Project Options dialog.

Go to "Project" Menu, then "Options", then "Conditional Defines" (or something similar).

{$define is LOCAL to the current file scope, unless you define it in the project shared options.
See http://stackoverflow.com/questions/1277 … onditional

Offline

#11 2013-02-17 19:02:19

Niko
Member
Registered: 2013-02-16
Posts: 5

Re: Compress data

If I don't use any Define, does the framework uses COMPRESSDEFLATE as default?

Offline

#12 2013-02-17 19:10:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Compress data

"Use the source, Luke!" and RTFM!

Both server side defines COMPRESSSYNLZ and COMPRESSDEFLATE in unit mORMotHttpServer.
There is no such compiler define in mORMotHttpClient - you have to use the Compressions property, setting e.g. Compression := [hcSynLZ, hcDeflate] to allow both SynLZ and deflate compression algorithms.
Just search for "compression" in mORMotHttpClient and I suspect you will find the info.

Offline

Board footer

Powered by FluxBB