I have been able to set up an INI file at the Client end so that the user can change the Port to connect to the server.
My challenge is to get working, at the server end, the ability to change the Port from an INI file.
I can change the Port at Design Time on the server. When compiled that runs with the Port as expected.
However, I can't seem to set the Port number from an INI file. It always takes the Design Time number.
I think the Port is taken from component TDSTCPServerTransport when the server component "runs"? The server component TDSServer is a property of TDSTCPServerTransport.
But I can't see an event in the server to latch onto.
If I set the Port in DataModuleCreate or DSServerClass1GetClass the number doesn't change from the value set at Design Time.
At which point do I set the Port number? (I am using Delphi XE6.)
The DataSnap server component TDSServer has property AutoStart with default value True. Consequently, at time in DataModuleCreate event the server is already started, and also port number for DSTCPServerTransport is already assigned, taken from value at design-time.
You have to set at design-time DSServer.AutoStart property to False, and in DataModuleCreate event you first set Port number of DSTCPServerTransport from INI file, and then Start manually in code the DataSnap server.