Erel, thank you.
I want to stop application using StopMessageLoop or ExitApplication, which will be called from the StopClass.
If I don't use StopClass, then procrun will kill the application as far as I understand.
There is no advantage for calling StopMessageLoop.
The disadvantage of calling StopMessageLoop is that there can be several message loops running at the same time in server apps. In some cases the "wrong" message loop may be closed.
Sub AppStart (Args() As String)
m_clsMain_AppContainer.Initialize
m_clsMain_AppContainer.Start
StartMessageLoop
m_clsMain_AppContainer.Finish
End Sub
and use this handler
B4X:
Public Sub Handle(req As ServletRequest, resp As ServletResponse)
resp.ContentType = "text/html"
resp.Write("Server stopping ...")
StopMessageLoop
End Sub
to stop the server and send the web page to a client with the message "Server stopping ..."
and it works like a charm.
If I replace StopMessageLoop with ExitApplication then server stops, but the webpage "Server stopping ..." is not displayed to the client.