3

I am developing a delphi xe5 datasnap client server application. In the server i have created several methods with parameters and i have some remote dataset providers. I use tcp/ip as protocol and a TSQLConnection in the client. I have generated the client classes with the wizard in the TSQLConnection.

Up until this point everything is working perfectly.

Now i am thinking about the following:

What approach must i choose to keep backwards compatibility for my clients when i keep developing the servers methods. It is impossible for me to update all the clients at the same time. It can take a long time between updating the first and last client to the same versions.

  1. What to do when i want to add extra (or delete) parameters in the server methods? Or want to change the datatype of the parameters?
  2. What to do when i want to add extra server methods? (this should not be a problem?)
  3. what to do when i change fields in the datasets in the server component?
  4. Can i run multiple versions of the datasnap server component on the same ip adress and same port nummer? Is there a sub-version / address?
  5. i have read something about dynamically generating the client classes on run-time, but i can not find anay detailed examples about that.

I hope i have typed my questions clearly for you.

Thnx for the help in advance!

marenk vos
  • 35
  • 3
  • Related: [How can I update a DataSnap server while clients are still connected?](http://stackoverflow.com/questions/944648/how-can-i-update-a-datasnap-server-while-clients-are-still-connected) – mjn Feb 17 '15 at 08:58

2 Answers2

0

Im no expert on Datasnap, but i can make the following suggestions:

Question 1 - 3 can be done by simply right clicking on the SQLConnection to datasnap and clicking on "Generate Datasnap Client Classes."

That will recreate the client classes unit on the client side and you will have the updated methods with your changes.

4) I dont believe that you can run two servers on the same PORT number. You can run on the same IP adress, with a different port number.

5) I can't say that ive encountered dynamically generating classes for datasnap.

I am also on a learning phase with Datasnap and i hope that there is someone who knows more about your question.

  • the key requirement is "it is impossible for me to update all the clients at the same time", questions 1 to 3 talk about keeping the API compatible between different client versions, iiuc – mjn Feb 17 '15 at 12:27
  • Two servers on the same computer can use the same port (see this SO question about [Socket options SO_REUSEADDR and SO_REUSEPORT](http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t)) – mjn Feb 27 '15 at 15:21
0

The easiest solution, but definitely not the most elegant, would be to run multiple servers on different ports.

Ex: your first server uses port 1000 and all current clients will use 1000. Your next build that breaks the current client would run on port 1001 and all new clients would use this port.

Once you have updated all old clients to the new client you can retire the server on port 1000.

  • If DataSnap needs more ports then client side firewalls require additional configuration. Can HTTP be used as transport for Datasnap? If yes then I would map my two servers to different URL paths, like `https://example.com/myapp/v1` and `https://example.com/myapp/v2` using a reverse proxy. – mjn Feb 27 '15 at 15:15