In Poco's documentation (https://pocoproject.org/docs/Poco.Util.ServerApplication.html) there is:
int main(int argc, char** argv)
{
MyServerApplication app;
return app.run(argc, argv);
}
This would imply a standalone, blocking server application. However, my use case is that I'd like to integrate a HTTP server to my already existing C++ application and it should not block the rest of the application. Can I somehow just start the Poco server in its own thread?
A ServerApplication
is meant to be its own Application
since it inherits from Application. This means it has its own main.
So it depends on what you want to do in your ServerApplication
.
If you want something else to be the main function, don't use ServerApplication
. But if you want the benefits of option parsing and portable code, use ServerApplication
and have it spawn your other code via a thread similar to SampleServer.
I hope this helps.
EDIT
It has an example Application that contains an HTTPServer. Maybe you just want an HTTPServer to start in your existing app.