title: SocketException for closing a UDP Socket
body: <p>I have a library written in C# which I have used it in WP7/iOS/Windows Apps. It works with Mono because I am just using UdpClient and nothing more. Its an open source library to find peers automatically. You can find it at <a href="http://salaam.codeplex.com" rel="nofollow">salaam.codeplex.com</a></p>
  
  <p>Now I am just trying to port my app to Android. When I found my peers, I just want to close the UDP connections and goto another activity but when I close the socket, despite the fact that I put it in a try catch phrase but it throws a <code>SocketException</code> and it exits.</p>
  
  <p>What can I do to prevent that?</p>
  
  <p>If you Finish the activity, it gives you that exception, if you call <code>SalaamBrowser.Close();</code> it's the same.</p>
  
  <p>Exception text:</p>
  
  <p>Unhandled Exception:
  System.Net.Sockets.SocketException: interrupted
    at System.Net.Sockets.Socket.ReceiveFrom_nochecks_exc (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint&amp; remote_end, Boolean throwOnError, System.Int32&amp; error) [0x00000] in :0 </p>
  
  <p>at System.Net.Sockets.Socket.ReceiveFrom_nochecks (System.Byte[] buf, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint&amp; remote_end) [0x00000] in :0</p>
  
  <p>at System.Net.Sockets.Socket+Worker.ReceiveFrom () [0x00000] in :0 </p>
  
  <p>Thanks</p>