TsgcUDPServer › Methods › ReStart
Stops and then restarts the server from a secondary thread, useful after changing bindings or ports at runtime.
procedure ReStart;
ReStart chains a Stop followed by a Start inside an internal worker thread, so the caller is not blocked while the listener is closed and reopened. It is the recommended way to apply configuration changes that require the server to re-bind its sockets at runtime, for example after editing Port, Bindings or DTLSOptions. The OnShutdown event fires once the old listener stops, and OnStartup fires again once the new listener is accepting datagrams. The internal WatchDog uses ReStart to recover from monitor timeouts.
oServer.Port := 6000;
oServer.ReStart;