title: When do I need to bind a socket?
body: <p>When do I need to bind a UDP socket?
  This code throws an exception saying I need to bind the socket first</p>
  
  <pre><code>// server
  Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  IPEndPoint remote = new IPEndPoint(IPAddress.Any, 0)
  byte[] buffer = new byte[1024];
  sock.ReceiveFrom(buffer, ref remote);
  </code></pre>
  
  <p>whereas this one doesn't</p>
  
  <pre><code>// client
  Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  IPEndPoint server = new IPEndPoint(IPAddress.Parse("server ip"), 1234);
  byte[] toSend = { 1, 2, 3 };
  sock.SendTo(toSend, server);
  byte[] buffer = new byte[1024];
  sock.ReceiveFrom(buffer, ref server);
  </code></pre>
  
  <p>I've had some theories, but none of them seems really plausible.</p>