rgreat Posted February 2, 2023 Share Posted February 2, 2023 StanAlone. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 2, 2023 Share Posted February 2, 2023 4 minutes ago, rgreat said: StanAlone. Hello, I use this to bind socket: function PortAvailable(Port:STring):boolean; var svr : TTCPBlockSocket; begin svr := TTCPBlockSocket.Create; try svr.Bind('0.0.0.0',Port); svr.Listen; result := svr.LastError = 0; Svr.CloseSocket; finally svr.Free; end; end; procedure TUniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject); begin //check port usage if (not PortAvailable (YourServerPort)) then begin UniServerModule.Terminated := True; Application.Terminate; exit; end; end; 1 Quote Link to comment Share on other sites More sharing options...
rgreat Posted February 2, 2023 Author Share Posted February 2, 2023 Well, that's kind of walk around approach, but thanks for idea. I was hoping for a more conventional approach. Quote Link to comment Share on other sites More sharing options...
irigsoft Posted February 2, 2023 Share Posted February 2, 2023 10 minutes ago, rgreat said: Well, that's kind of walk around approach, but thanks for idea. I was hoping for a more conventional approach. at this moment I know, only this way. If you find another one, could you please share it 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.