title: Sending and Receiving UDP packets
body: <p>The following code sends a packet on port 15000:</p>
  
  <pre><code>int port = 15000;
  UdpClient udp = new UdpClient();
  //udp.EnableBroadcast = true;  //This was suggested in a now deleted answer
  IPEndPoint groupEP = new IPEndPoint(IPAddress.Broadcast, port);
  string str4 = "I want to receive this!";
  byte[] sendBytes4 = Encoding.ASCII.GetBytes(str4);
  udp.Send(sendBytes4, sendBytes4.Length, groupEP);
  udp.Close();
  </code></pre>
  
  <p>However, it's kind of useless if I can't then receive it on another computer.  All I need is to send a command to another computer on the LAN, and for it to receive it and do something.</p>
  
  <p>Without using a Pcap library, is there any way I can accomplish this?  The computer my program is communicating with is Windows XP 32-bit, and the sending computer is Windows 7 64-bit, if it makes a difference.  I've looked into various <code>net send</code> commands, but I can't figure them out.</p>
  
  <p>I also have access to the computer (the XP one)'s local IP, by being able to physically type 'ipconfig' on it.</p>
  
  <p><strong>EDIT:</strong> Here's the Receive function I'm using, copied from somewhere:</p>
  
  <pre><code>public void ReceiveBroadcast(int port)
  {
      Debug.WriteLine("Trying to receive...");
      UdpClient client = null;
      try
      {
          client = new UdpClient(port);
      }
      catch (Exception ex)
      {
          Debug.WriteLine(ex.Message);
      }
  
      IPEndPoint server = new IPEndPoint(IPAddress.Broadcast, port);
  
      byte[] packet = client.Receive(ref server);
      Debug.WriteLine(Encoding.ASCII.GetString(packet));
  }
  </code></pre>
  
  <p>I'm calling <code>ReceiveBroadcast(15000)</code> but there's no output at all.</p>