On 14/12/2020 18:27, Dominique Devienne via Boost-users wrote:
I finally figured this out, mostly by chance...
As the extract below shows, Beast's example uses tcp::endpoint{net::ip::make_address("0.0.0.0"), port} in its sample usage, and I had copy/pasted that in my code (using "0.0.0.0"). This works, in that the server starts fine, and clients work fine too, but leads to those > 1,000ms client connection times on Windows.
Now you describe this, this is familiar. Windows has always done this. Sorry I didn't think of it sooner.
While using e.g. tcp::endpoint{ tcp::v6(), port } results in 20-30ms connection times on Windows. (2-3ms on Linux).
If you're on loopback and you'd like to close that gap, you need to turn on SIO_LOOPBACK_FASTPATH. I've no idea if ASIO can do that for you, I'm still on a pre-churn ASIO. An alternative is to bind to a real NIC, and not go via loopback. If you're on a real NIC over a real network, I find a 20-30ms connection time abnormal. Windows 10 has a fast TCP stack, compared to previous Windows. It should be single digit milliseconds. Niall