How to change the Port on the DataSnap Server through the INI file

1

I'm trying to set up an INI file to be able to access the client in order to be able to connect to the service through the port that it has determined.

I get no problems at all, change in design mode, compile the project executes and start working on the port as expected. However, I need the service to take the port of the INI file, it always takes the design mode, I tried to change it before starting the service but I did not succeed.

I create a project by the following path:

File-> New-> Other-> DataSnap Server

How do I change the port number?

OBS: I'm using Delphi XE7

    
asked by anonymous 18.11.2016 / 13:06

1 answer

1

I have decided as follows:

When you create the DataSnap Server project, one of the classes responsible for connection and communication is ServerContainerUnit , in this class it contains a connection component called DSServer1 which by default comes as AutoStart enabled.

To solve my problem, I deactivated the AutoStart of the component, and in Create, I added the code:

DSHTTPService1.SetHttpPort(porta);
DSServer1.Start;
    
25.11.2016 / 13:03