I am using boost::asio::ip::udp::socket
to communicate. I use socket.receive_from(...)
to receive messages from clients. This is working fine for now, but I want to be able to shut down my server. Right now I am calling receive_from
in a while-loop, which depends on a bool condition which I can set. However, this is pretty useless if I cannot force the thread to exit receive_from
at regular intervals or at a certain call.
Is this even possible? I have tried googling, but found no clear answer. I have tried using socket.cancel()
but this seems to have no effect.
Am I using the socket in the correct way?