B4J Question ExitApplication in a web server hangs the connection

Bruce Axtens

Active Member
Licensed User
Longtime User
B4X:
    restServer.AddHandler("/epoxy/shutdown", "EpoxyShutdown", False)

...

Sub Handle(req As ServletRequest, resp As ServletResponse)
    resp.Write("OK")
    Log("Shutting down.")
    ExitApplication2(0)
End Sub
When I send a GET to localhost:8888/epoxy/shutdown the connection hangs and times out. And I don't see the "OK" in the stream back from the server either.

The following is from my JScript CLI tool
B4X:
f = new Http("http://localhost:8888/epoxy/shutdown")
f.setVerb("GET").openConnection().sendTraffic().result()
-> false,-2147483638,The data necessary to complete this operation is not yet available. [http://localhost:12345/epoxy/shutdown],,
Is there a more graceful way of shutting down the server?
 

Bruce Axtens

Active Member
Licensed User
Longtime User
Works at treat. Thank you.
 
Upvote 0
Top