title: Close a socket and then reopen it from the same port in .net
body: <p>Well, I wonder if some one can help with a problem that I encounter....</p>
  
  <p>I want to close a socket and then rerun from the same port. This is what i am doing...</p>
  
  <p>opening:</p>
  
  <pre><code>    UdpServer = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
      UdpServerIpEndPoint = new IPEndPoint(IPAddress.Any, 9050);
      UdpEndPoint = (EndPoint)UdpServerIpEndPoint;
      UdpServer.Bind(UdpServerIpEndPoint);
  </code></pre>
  
  <p>closeing:</p>
  
  <pre><code>        UdpServer.Shutdown(SocketShutdown.Both);
          UdpServer.Disconnect(true);
          UdpServer.Close();
  </code></pre>
  
  <p>After I close it. and the I try to reconnect it with the same code as above, I get error:</p>
  
  <blockquote>
    <p>Additional information: Only one usage of each socket address
    (protocol/network address/port) is normally permitted</p>
  </blockquote>
  
  <p>I checked for exception during closing, but I didnt get any, i guessed they were closed properly, so actually, what is causing this problem? Please help!</p>