title: C# simple DHCP server, DNS request?
body: <p>I am programming a new piece of test equipment for a new product for my company.</p>
  
  <p>One of the tests is ethernet testing and I am told will test like this.</p>
  
  <ol>
  <li>Once Product is connected via Ethernet it will request an IP address using the DHCP protocol.</li>
  <li>The MAC address is to be captured and verified.</li>
  <li>An IP address is given to the product.</li>
  <li>Now the product requests the IP address for the hostname "something.something.something.se"</li>
  <li>The hostname must be checked and verified.</li>
  <li>The DNS server sends back an IP address for the hostname.</li>
  <li>The product will then make a TCP connection to the given IP address.</li>
  </ol>
  
  <p>My problem is that I receive a DHCP Discovery message from the product and I respond. I then receive the DHCP Request message for the IP address (Step 1). I send back an IP address and then I hear no more from the product.</p>
  
  <p>If I PING the product on the IP address I gave I get a response so I know the product has received and set its IP address.</p>
  
  <p>I am using a UdpClient to do the communicating and is set-up like so</p>
  
  <pre><code>IPEndPoint ProductEndPoint = new IPEndPoint(IPAddress.Any, 0);
  UdpClient host = new UdpClient();
  host.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
  host.Client.Bind(new IPEndPoint(IPAddress.Parse("192.168.0.1"), 67)); //192.168.0.1 is ip address of PC
  
  for(int i = 0; i &lt; 30; i++)
  {
    if (host.Available &gt; 0)
    {
      byte[] Data = host.Receive(ref ProductEndPoint);
  
      // Do something with the data
    }
    else
      Thread.Sleep(1000);
  }
  </code></pre>
  
  <p>Any idea why I get no response back for Step 4?</p>
  
  <p>EDIT
  I have checked the IP address being sent as the DNS and I have changed it to 192.168.0.1 (was 0.0.0.0) but still no change. As I said I know product got the IP address as I can ping it but it seems to have an issue with the DNS address. I have confirmed this as the product has a flashing red light which I am informed means a DNS request has failed.</p>