title: How can I get the name and IP of all devices in my network or get the router IP that I am connected to?
body: <p>Ok, so I am trying to write an application which works with a piece of hardware (a router). The first part of my application is to obviously detect if the device is on the network (either on the WAN side or the LAN side as the router can be accessed from both sides, whether you are connected to a down stream router or a directly to the router I am trying to access through the application) - I hope this is making sense.</p>
  
  <p>The two options I have thought of to detect if the device is on the network are:</p>
  
  <ol>
  <li>Because I know the name of the device on the Network, could I get the application to compile a list of all the deices connected to the network and the check to see if the name of the device I am looking for is any of them?</li>
  <li>The second option would mean that the application could only connect automatically if the application was connected to the LAN side of the router, and therefore is not as favourable as the user would have to enter the IP of the router id they were trying to access from the WAN side. The way I would do it is simply get the default gateway of the router through the allocation somehow and then just send an API request to it and see if it replies (if it replies I can assume I have connected to the correct device).</li>
  </ol>
  
  <p>So to sum up is that I either need a way to get the names + IPs of all the devices connected to the network I am on (that is the preferable solution) or a way to get the default gateway (router IP address).</p>
  
  <p>I am very new to this, so please be over informative for me so that I understand. I would appreciate it if you could really explain how to implement this, maybe so that I can just have it print it out in the console - then I can implement it into my program and do what I need to do.</p>