title: Check if Private IP address is in use
body: <p>From my understanding DHCP automatically assigns an IP address to a device. If i want to manually set the IP address of a device within the Host's (Windows Host) private network within the range 192.168.0.0 - 192.168.255.255 . How can i check if that address has been already taken. </p>
  
  <p>I want to write a function that will increment through valid addresses with the private network range. If valid and not used then return that address. I need some way to implement the <code>ip_is_valid(int*ip_addr)</code> function.</p>
  
  <pre><code>bool assign_ip( int* ip_addr)
  {
      int new_ip_addr[4] = {192,168,0,0};
      for (int i = 0; i &lt; 255; i++)
      {
          new_ip_addr[2] = i
          for (int j = 0; j &lt;255; j++)
          {
              new_ip_addr[3] = i;
              if (ip_is_valid(new_ip_addr))
              {
                  ip_addr[0] = new_ip_addr[0];
                  ip_addr[1] = new_ip_addr[1];
                  ip_addr[2] = new_ip_addr[2];
                  ip_addr[3] = new_ip_addr[3];
                  return(true);
              }
          }
      }
      return(false);
  }
  </code></pre>
  
  <p>What existing C++ library can i use in order to access currently released IPs or what simple way can i check to see if the IP is used (ping?).</p>
  
  <p><strong>EDIT:</strong> I think i may have miss worded my original question. The "Network" that i am using is just the PC's private addressing space. It is local and isolated. For example if i plug in an Ethernet device the PC would assign it a private IP address within the range 192.168.0.0 - 192.168.255.255. Only to be used by the host machine. The manual address i am setting is temporary. Will be used for less than a minute then discarded. I am not worried about any networking constraints or problems just how i can check if an ip has been used.</p>