55143681 Posted January 8, 2021 Share Posted January 8, 2021 As you know,You can setup the listen port from ServerModule->port property, Now ,I want to setup the listen port from a my.ini file, when my project start ,it will read my.ini and get the listen port, then my project will listen the port. what I want to say is that how to change my server port from my.ini file. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 8, 2021 Share Posted January 8, 2021 Uses IniFiles; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); var Ini: TIniFile; begin Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'AppIni.ini'); try Port := Ini.ReadInteger('Settings', 'Port', 8077); finally Ini.Free; end; end; What type of application? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted January 8, 2021 Share Posted January 8, 2021 Hi, Can we without (or must be with) mutex disable start of unigui application/service if port already used ? Can we disable starting two application on one port some how. I have problem with that, if I start two unigui application on one port, second shows error but port is can not usable anymore after second application was startet with error Quote Link to comment Share on other sites More sharing options...
55143681 Posted January 10, 2021 Author Share Posted January 10, 2021 On 1/8/2021 at 11:57 PM, Sherzod said: Uses IniFiles; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); var Ini: TIniFile; begin Ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'AppIni.ini'); try Port := Ini.ReadInteger('Settings', 'Port', 8077); finally Ini.Free; end; end; What type of application? I know that ,thanks, but in the before unigui version, the follow code will have error: UniServerModule()->Port=8077; Now,the code works well. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.