You are not logged in.
I sent an e-mail...thanks
Offline
OK, no problem. Thanks for your time. I will contact you next week if you do not get news.
Thanks again.
Offline
Do you have some new about my problem? Thanks
Offline
Many thanks
Offline
Were you able to reproduce my problem?
Offline
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
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
OK, but how UpdateFromServer works when an user delete a record from database?
Any new about my problem?
Offline
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
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
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
Do you have some new?
Offline
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
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
I have removed SQLite3i18n dependence so I don't have problem
I like know if you were able to reproduce my problem or not. thanks
Offline
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
I have test my LAN speed, tou can see the result here:
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:
Please Ad reply. Thanks
Last edited by array81 (2011-03-01 00:16:02)
Offline
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
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
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
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
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
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
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
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
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:
2) When I read to read:
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
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
Are you sure you got the latest version of all units from http://synopse.info/fossil ?
Offline
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
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.
Offline
This sound good.
I'm waiting for it, so I will test it. Thanks.
Offline
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
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
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
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
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
I need to understand if I have understand
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
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
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
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