title: Boost::asio udp socket - how should I use the API to allow cancellation of reads?
body: <p>I am using <code>boost::asio::ip::udp::socket</code> to communicate. I use <code>socket.receive_from(...)</code> 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 <code>receive_from</code> 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 <code>receive_from</code> at regular intervals or at a certain call.</p>
  
  <p>Is this even possible? I have tried googling, but found no clear answer. I have tried using <code>socket.cancel()</code> but this seems to have no effect.</p>
  
  <p>Am I using the socket in the correct way?</p>