title: Boost UDP socket issue on unix - bind: address already in use
body: <p>First of all, I know there are several other threads on the same theme, but I was unable to find anything in those that could help me so I'll try to be very specific with my situation.</p>
  
  <p>I have set up a simple UDP Client / UDP Server pair that is responsible to send data between several parallel simulations. That is, every instance of the simulator is running in a separate thread and send data on a UDP socket. In the master thread the server is running and routes the messages between the simulations. </p>
  
  <p>The (for this problem) important parts of the server code looks like this:</p>
  
  <pre><code>UDPServer::UDPServer(boost::asio::io_service &amp;m_io_service) :
     m_socket(m_io_service, udp::endpoint(udp::v4(), PORT_NUMBER)),
     m_endpoint(boost::asio::ip::address::from_string("127.0.0.1"), PORT_NUMBER)
  {
     this-&gt;start_receive();
  };
  
  void UDPServer::start_receive() {
  
     // Set SO_REUSABLE to true
     boost::asio::socket_base::reuse_address option(true);
     this-&gt;m_socket.set_option(option);
  
     // Specify what happens when a message is received (it should call the handle_receive function)
     this-&gt;m_socket.async_receive_from(   boost::asio::buffer(this-&gt;recv_buffer),
                                          this-&gt;m_endpoint,
                                          boost::bind(&amp;UDPServer::handle_receive, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
  
  };
  </code></pre>
  
  <p>This works fine on my windows workstation.</p>
  
  <p>The thing is; I want to be able to run this on a linux cluster, which is why I compiled it and tried to run it on a cluster node. The code compiled without a hitch, but when I try to run it I get the error</p>
  
  <pre><code>bind: address already in use
  </code></pre>
  
  <p>I use a port number above 1024, and have verified that it is not in use by another program. And as is seen above, I also set the <code>reuse_address</code> option, so I really don't know what else could be wrong.</p>