#51 2011-02-03 09:23:14

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

Re: Load/save image

Yes the mail button will be working just fine.

Offline

#52 2011-02-03 11:58:15

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I sent an e-mail...thanks

Offline

#53 2011-02-03 15:40:09

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

Re: Load/save image

I received the email.
But I won't have time to test it over a network before the beginning of next week.

Offline

#54 2011-02-03 15:59:43

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

OK, no problem. Thanks for your time. I will contact you next week if you do not get news.

Thanks again.

Offline

#55 2011-02-09 09:07:02

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Do you have some new about my problem? Thanks

Offline

#56 2011-02-09 10:19:53

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

Re: Load/save image

Will investigate tonight - I need some time and a physical network to try to reproduce the issue.
smile

Offline

#57 2011-02-09 10:28:09

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Many thanks smile

Offline

#58 2011-02-11 09:17:28

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Were you able to reproduce my problem?

Offline

#59 2011-02-13 17:28:49

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Until you try to reproduce my problem I have another question: I have try to use TNotifySQLEvent and TSQLRestClientURI.UpdateFromServer functions to syncronize my server and clients but I think I don't have understand how use them because I application didn't work.
Do you have a small example abut them?

Offline

#60 2011-02-13 19:19:06

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

Re: Load/save image

TNotifySQLEvent is to be used for implementing triggers in Delphi, not for synchronization. Because it could be not launched in some SQL statements, modifying directly the database.

UpdateFromServer is the function to use for synchronization.
See for instance:
- http://synopse.info/forum/viewtopic.php?pid=1155#p1155
- http://synopse.info/forum/viewtopic.php?pid=1058#p1058

And the UpdateFromServer method comments in the source code, of course.

Offline

#61 2011-02-13 23:22:42

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

OK, but how UpdateFromServer works when an user delete a record from database?
Any new about my problem?

Offline

#62 2011-02-14 06:47:36

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

Re: Load/save image

When a record is deleted from the database:
- UpdateFromServer([aTable]) will have the corresponding record erased from aTable rows;
- UpdateFromServer([aRecord]) will return FALSE if aRecord was deleted.

About the network problem, I was not able to reproduce it yet...

Offline

#63 2011-02-14 08:29:33

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

About my LAN problem...
I have made some other test. I have tested your official client/server demo on real lan (2 computers: client and server). I have define {$define DEBUGCLI} on SQLiteHttpClient.pas so I have try to add a record and load the same record from database.

Client console result:

2011-02-14 09:20:48 POST root/SampleRecord {"Time":"2011-02-14T09:20:48","Name":
"pippo","Question":"cane"}
201 297ms len=0
2011-02-14 09:21:07 GET root SELECT * FROM SampleRecord WHERE Name="pippo" LIMIT
 1;
200 328ms len=73

http://localhost:8080/root/stat result (on server):

Clients now=2 max=2
Data in=217 B out=134 B
Requests=2 Updates=1 Invalid=0
Time spent in requests = 118.40ms

Time spent in requests is high also with your demo so I don't think the problem is my application. I think there a problem on Framework or on my LAN but I have used 2 very different LAN to make the test (with different computers and different OS)...

What do you think about it? Thanks

Offline

#64 2011-02-15 10:09:55

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

Re: Load/save image

118.40 ms in the server with a record adding is possible, due to the SQLite locking mechanism, which can be slow (transactions are mandatory if you need to add a lot of records).

What worries me is the 328 ms latency for a simple select.
I still need some investigation...

Offline

#65 2011-02-17 08:59:14

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Do you have some new?

Offline

#66 2011-02-18 23:19:54

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have another small problem, if I include SQLite3i18n.pas on my uses all string about "time" are in english. I use some 3rd components like BergSoft suite and Planners for VCL, all strings about date (ex. name of days: monday, ...) or time (I see AP/PM time) of these components are in english language and not in italian language. If I remove SQLite3i18n.pas (but I need of it) from uses classes all strings are in ITALIAN.
I don't know why...

Do you have some news about LAN problem? My application is almost finish.

Offline

#67 2011-02-19 08:27:59

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

Re: Load/save image

Take a look at the SQLite3i18n documentation (i.e. the embedded comments, or the latest SAD file available in this site).

You'll find out that if you use this unit, you MUST initialize the main Language global class instance.

See LangInit procedure which is called on startup in initialization.
You'll have to set the registry from some value.

Offline

#68 2011-02-24 10:15:10

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have removed SQLite3i18n dependence so I don't have problem smile

I like know if you were able to reproduce my problem or not. thanks

Offline

#69 2011-02-28 16:27:42

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I don't have any news about my LAN problem. I'd like know if this is only my problem. I don't think because I have the same problem with official demo and 2 very different LAN.
Can I have some news?...

Offline

#70 2011-03-01 00:09:33

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have test my LAN speed, tou can see the result here:

lantest.png

Besides In my application now use also a TCP connection with Indy components and this is very fast.

Another think (I don't know if it can help you), sometime when I try to load data from client application I have this error:

lanerror.png


Please Ad reply. Thanks

Last edited by array81 (2011-03-01 00:16:02)

Offline

#71 2011-03-01 06:15:59

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

Re: Load/save image

I'll try something else, but I'll have to go in another direction.

About Indy, are you using HTTP as protocol, or row TCP/IP packets?

I've added a new feature, which will help speed up the connection in case of a lot of successive adds, updates or deletes of records.
See http://synopse.info/forum/viewtopic.php?id=250

Offline

#72 2011-03-01 06:43:45

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

Re: Load/save image

Could you try to modify the following line of SynCrtSock.pas, setting LOOPWAIT to 1 instead of 64:

procedure THttpServerResp.Execute;
procedure HandleRequestsProcess;
var c: char;
    StartTick, StopTick, Tick: cardinal;
const LOOPWAIT = 1; // ms sleep beetwen connections
begin
  try
    repeat
      StartTick := GetTickCount;
      StopTick := StartTick+fServer.ServerKeepAliveTimeOut;
      repeat

Please tell if there is some improvements...

Offline

#73 2011-03-01 08:41:30

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Thanks for you reply.

1) I have tested "const LOOPWAIT = 1; " but I don't have improvements;
2) I use Indy for TCP/IP connection from clients and server. I use it to upgrade all the clients after database is edit;
3) I just have see you batch methods but I use many Database.ExecuteList functions on my application to send specific SQL and I cannot use your batch system with them.
4) You said "I'll try something else, but I'll have to go in another direction.". Do you have some idea?

5) Another question: on Database.OnUpdateEvent event, can I know the ip address of application (client/server) that have update the database?

Thanks again for your support.

Offline

#74 2011-03-01 08:56:21

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

Re: Load/save image

Could you make a try to the updated version of SynCrtSock.pas:
http://synopse.info/fossil/artifact/2b7 … ba29214629

I've reorganized the server thread, which calls diverse WinSock API, and don't call GetPeerName any more.

Offline

#75 2011-03-01 09:36:17

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have replace SynCrtSock.pas the I have repeat the test of message #63 (on the same LAN with the same PC).

Client console result:

2011-03-01 10:31:51 POST root/SampleRecord {"Time":"2011-03-01T10:31:51","Name":
"pippo","Question":"cane"}
201 281ms len=0
2011-03-01 10:31:57 GET root SELECT * FROM SampleRecord WHERE Name="pippo" LIMIT
 1;
200 375ms len=73

http://localhost:8080/root/stat result (on server):

Clients now=2 max=2
Data in=217 B out=134 B
Requests=2 Updates=1 Invalid=0
Time spent in requests = 81.78ms

Any comments...
On my application I have also the lag-time. I begin to think that it is impossible to solve but should be a few bytes of data (up to a few kb)...

Last edited by array81 (2011-03-01 09:38:36)

Offline

#76 2011-03-01 10:06:19

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

Re: Load/save image

Did you try to set the AntiVirus protection Off on both computers ?

Since our framework uses HTTP and not plain TCP/IP, the antivirus may try to scan the content for any virus...

MSE is known to have slow down issues...

It's also very important NOT to install MSE and any other anti-malware software.
Such a combination can make your computer down....

Offline

#77 2011-03-01 10:35:34

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Yes, sorry on my last test I forgot to disable MSE, so I have repeat it. With MSE disable on all PC (I don't have any other antivirus or antispayware installed):

Client console result:

2011-03-01 11:25:17 POST root/SampleRecord {"Time":"2011-03-01T11:25:17","Name":
"pippo","Question":"cane"}
201 187ms len=0
2011-03-01 11:25:30 GET root SELECT * FROM SampleRecord WHERE Name="pippo" LIMIT
 1;
200 297ms len=73

http://localhost:8080/root/stat result (on server):

Clients now=2 max=2
Data in=217 B out=134 B
Requests=2 Updates=1 Invalid=0
Time spent in requests = 72.84ms

in my application there is perhaps a small improvement, but very small (I have not measured)...

Last edited by array81 (2011-03-01 10:36:35)

Offline

#78 2011-03-02 08:14:22

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

Re: Load/save image

Could you make a try to the latest revision:
http://synopse.info/fossil/info/9098c15a11

Then enable the USETCPPREFIX conditional (globally for both client and server).

If defined, a prefix will be added to the TCP/IP stream so that it won't be valid HTTP content any more: it could increase the client/server speed with some anti-virus software or firewall, but the remote access won't work any more with Internet Browsers nor AJAX applications.

Offline

#79 2011-03-02 10:04:10

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have upgrade my Frameworks version then I have enable USETCPPREFIX conditional for client and server. I have repeat the same test (antivirus OFF):

1) When I try to add a record:

writeerror.png

2) When I read to read:

readerror.png

I have the same errors if I use both client and server application on the same PC.


The aftenoon I will try with my application.

Last edited by array81 (2011-03-02 10:17:20)

Offline

#80 2011-03-03 17:07:14

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Always from official HTTP demo, this is the log file after error:

2011-03-03 18:04:50 TSQLRestServerDB.EngineExecute: near ")": syntax error  INSERT INTO SampleRecord ) VALUES );

Offline

#81 2011-03-03 17:53:09

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

Re: Load/save image

Are you sure you got the latest version of all units from http://synopse.info/fossil ?

Offline

#82 2011-03-03 18:37:07

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

Yes, I'm sure. I have delete all file about the framework then download the last version in this moment [81a74b3a0f] and repeat the same test (official HTTP demo, client and server on the same PC). If I don't define USETCPPREFIX the demo work, but if I define USETCPPREFIX (both on SQLite3HttpServer.pas and SQLite3HttpClient.pas files) I have the same error of the my last posts.

Offline

#83 2011-03-08 19:58:09

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

Re: Load/save image

I'm currently adding http.sys support for the HTTP server side.
This is the core HTTP server written by Microsoft for its IIS, and it's available in Windows since XP SP2.
It's running in kernel mode, so it's very fast and reliable.

I hope that with this one, we won't have any performance issue, which I was not able to reproduce.
And in all cases, http.sys is a better solution that any thread pool + I/O completion ports, for serving HTTP content, AFAIK.
wink

Offline

#84 2011-03-08 23:07:10

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

This sound good.

I'm waiting for it, so I will test it. Thanks.

Offline

#85 2011-03-10 23:24:29

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I have download and replace your new version of framework (with http.sys support) then I have define USEHTTPAPI. When I try to compile my application I have an error on line 3043 of SynCommons.pas.

[Pascal Error] SynCommons.pas(3043): E2006 PACKED not allowed here

How can I fix it? I'd like try it.

Last edited by array81 (2011-03-10 23:25:08)

Offline

#86 2011-03-11 17:39:13

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

Re: Load/save image

Try last version on source code repository.

Which version of the compiler do you use?

Offline

#87 2011-03-13 17:12:18

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

With the last version I have the same error. To fix it I have change:

TFileVersion = packed object

to

TFileVersion = packed record

This works (I use Delphi 2006).

Another think, can you add a demo on your official demo to show the new HTTP system (http.sys support) and THttpApiServer.AddUrlAuthorize use for windows 7 and Vista? I think I don't understand how replace my old TSQLite3HttpServer with these new functions.

Offline

#88 2011-03-13 19:44:16

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

Re: Load/save image

You're right!

I'm fed up with all those backward incompatiblies just to maintain the source code from Delphi 6 up to XE...

Fixed in the source code repository (by using {$A-} instead of packed)...

Note that the latest version in the source code repository will always use http.sys if available (not need to define a conditional any more).

Offline

#89 2011-03-13 20:01:23

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

So can I use my code (with TSQLite3HttpServer) without edit it?
In this way it works also for Windows 7 and Vista without administrator right?

It 's all automatic?

Offline

#90 2011-03-14 16:19:32

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

Re: Load/save image

No it's all automatic: you'll still have to launch once a setup program with administrator rights in order to add the expected HTTP url to the http.sys internal list.
See the blog entry.

But once it was run on the Vista/Seven computer, the server will work without modification, even after reboot, or run with another user (e.g. a service or a GUI program are run with diverse users).

Offline

#91 2011-03-14 17:05:04

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

I need to understand if I have understand smile

1) I don't need change my code: I can use my TSQLite3HttpServer for Server application because it just use the new functions (http.sys) if possible and TSQLite3HttpClient for Client application;
2) If I want use http.sys on Windows 7 or Vista I need:
2a) Run ONE TIME (the first time) as administrator the server application (on server computer) so when TSQLite3HttpServer will be create it will add expected HTTP url (if I will change port number I need run server application as administrator again, obviously), in alternative the server application will be run with the "old" system;
2b) Nothing change for client application, I need only run it as administrator or as simple user.

It is correct?

Offline

#92 2011-03-14 17:31:46

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

Re: Load/save image

1) is correct

2a) not exactly

In the current implementation, you should create a separate program which should contain the VistaAdm.res file: so it will be automatically asked to be run as Administrator - this is more convenient for the end user to run a dedicated program which will elevate itself thanks to the UAC than run a software with identifying its executable, then right click and select "Run as Administrator".

For an example of that, take a look at TestSQLite3.dpr as the server, and TestSQL3Register.dpr as the UAC ready program to register the needed URL.

2b) is correct

Offline

#93 2011-03-15 10:20:25

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Load/save image

OK but if I run the server application as administrator (on vista and 7) do I need use TestSQL3Register.dpr to register the needed URL? Do I need register the needed URL only if I want run the server application as simple user or I need register the needed URL both for administrator and simple user?

Offline

#94 2011-03-15 11:02:19

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

Re: Load/save image

You can add the THttpApiServer.AddUrlAuthorize() class method in your server program, if you are sure that it will be run as administrator.

But note that the current user having the administrator rights is not enough: you should elevate the user to the administrator level via {$R VistaAdm.res} and accept the UAC popup window...
So I guess this is not a good way of using it. An external setup program run once is more user-friendly IMHO.

Yes, I know... This UAC is (sometimes) a mess...

Offline

Board footer

Powered by FluxBB