Thanks for your reply. I'm sure that's not the problem, as the console window doesn't close.
The server starts and continuously waits for a connection until the command-line kill signal is given, and even after that the console window remains open. The problem is that it doesn't allow for any console output while the server is in that awaiting-connection state.
More likely, it has to do with io_context.run() holding the thread hostage with busywork to keep the server alive, and that is somehow interfering with std::couts ability to print to standard out. This is just conjecture though and I'd need someone to verify.
This problem is completely separate from a client connection. I'm not trying to send or receive data over the server. Just output to the console while the server is running. For instance, when the server boots, I might want to output "Server has booted", but nothing appears.
That ends the line AND flushes the stream immediately. The text will appear, but THEN you'll see the hang continue.
Two separate issues.
Now, as to io_context run....
This is a run loop. It is supposed to "hang" - it services the asio connection system. Servers are simply supposed to continue operating until shut down.
The issue is that asio is far more complex than this simple example will logically handle. It may actually work, don't get me wrong (though I feel certain it isn't enough to actually receive anything), but this is way too simple a configuration of code to actually work.
Asio, put simply, requires threads - and it should manage threads intelligently (it has support to handle thousands of connections on a few threads launched in acknowledgement of the limited number of cores on a particular processor).
You'll simply need to run through the tutorial examples for building Asio servers to continue.
That's embarassing. I guess it just needed a flush. Was wondering why I couldn't find more articles on something like this, as if it were a common problem, it should be easy to find.
I searched "io_context blocking output" "boost asio std::cout" and all sorts of other things but couldn't find anything.