Find all IPs in a subnet


I am developing a part of code using C++ for our project, my code must return a list of all available IPs in a subnet, so I have this scenario:


Get my subnet.

</li> <li>

Test every IP in subnet using a for loop, e.g.:

for (int i = 0; i < 254; i++) { testip(X, X, X, i); /* if IP is valid */ vectoriplist.push_back(X, X, X, i); } </li> </ol>

For find subnet I think I will use <a href="http://ipnetwork.codeplex.com/" rel="nofollow">IPnetwork utility</a>, but I still have another problem and it's how I can test if the IP is valid on the subnet. I try to use boost.asio, but I cannot find anything.


i found a solution :

i use coonect() and getpeername() functions in for loop . to get all valid ip addresses in a subnet


  • Search file for matching IP address in Linux
  • Find the MAC address of all devices connected to the same Wifi network
  • Setting up the network for Kubernetes
  • C# foreach - Is collection computed with each iteration? [duplicate]
  • Google OAuth2 for an web application hosted behind NAT (intranet server without public IP)
  • How to resolve docker host names (/etc/hosts) in containers
  • Spring security - same page to deliver different content based on user role
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • How to log in to an HTTPS website with Jsoup?
  • Google Places API - Find a company's CID and LRD
  • Facebook iOS SDK Not Calling Completion Handler
  • Image map in Flex
  • ASP.NET MVC Application won't update some controllers
  • What's the purpose of QString?
  • How can I speed up CURL tasks?
  • Mysterious problem with floating point in LISP - time axis generation
  • How to know when stdin is empty if it contains EOF?
  • Allowing both email and username for authentication
  • Refering to the class itself from within a class mehod in Objective C
  • Cannot resolve symbol 'MyApi'
  • Handling un-mapped Rest path
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Nant, Vault & Windows Integrated Authentication
  • What is Eclipse's Declaration View used for?
  • JSON with duplicate key names losing information when parsed
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Jquery - Jquery Wysiwyg return html as a string
  • SVN: Merging two branches together
  • Acquiring multiple attributes from .xml file in c#
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Append folder name and increment by 1 using batch script
  • Sorting a 2D array using the second column C++
  • Reading document lines to the user (python)
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal