getting all local ip's (arp -a)


I am making a nice multiplayer application but I want my application to search for hosts in you lan. I know that you can obtain your own IP quite easily and then brute force all IPs to see if anything is connected, but this is both quite hard work for your computer and it takes a some time as well even when you multithread it properly.

There seems to be no good way to obtain the arp table in java but I hope there is something similar where you can obtain all local IP-addresses fast and efficient.

Any help would be much appreciated.


Several options exists and can be used to achieve this.

<strong>The decentralized one</strong>

What you could do is <a href="https://en.wikipedia.org/wiki/Broadcasting_%28networking%29" rel="nofollow"><em>broadcasting</em></a> a request from your application that asks every hosts on the network if they are currently available for a game (sending the request on for instance, will cause your router to retransmit the datagrams you sent to every host on a LAN).

This will ensure that only the hosts that have the game launched and which are ready to play will respond to this request.

Several broadcasting protocols are today heavily used on a LAN. One of them is <a href="http://fr.wikipedia.org/wiki/Simple_Service_Discovery_Protocol" rel="nofollow">SSDP (Simple Service Discovery Protocol)</a> which is used with the UPnP protocol for service discovery. There are certainly better suited protocols used over broadcast/multicast for multiplayer games though.

<strong>The centralized one</strong>

One of the commonest way to discover players on a multiplayer game remains in the presence of a central server on which both <em>requester</em> (people who are looking for a game) and <em>hosters</em> (people who are hosting a game) are connected.

This method has the disadvantage of having a single point of failure, which is the server, but has the advantage, unlike the decentralized solution, of being both suitable for a LAN and for Internet (or every IP based protocol).

If I had to develop a multiplayer game this is where I would start digging regarding the host discovery feature you are required to implement.


  • Javascript Changing the selected Menu items class
  • How do I make sure that there is always something selected in a Spark List?
  • Best practice to save files in blockchain
  • $interval not running, angularjs
  • Get XML response value with GDataXML
  • Laravel include causes error: Method Illuminate\\View\\View::__toString() must not throw an exce
  • Each Radiobutton for each form or 1 Form for all radiobuttons?
  • Mysql query to determine if the given datetime is included in the datetime interval
  • Catching exception and throwing the same?
  • TextBox AutoCompleteStringCollection Suggest
  • Making Cross Site Asynchronous HTTP Post from GWT Client
  • How do i disable a text box within an iframe
  • Can I use Jquery to automatically find and set the width and height of a variety of images?
  • Zeromq with python hangs if connecting to invalid socket
  • Receiver has no segue with identifier“***”
  • in batch how do i use taskkill properly
  • Clear activity stack before launching another activity
  • Django model inheritance, filtering models
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • Groovy: Unexpected token “:”
  • PHP buffered output depending on server setting?
  • Custom Tabgroup Appcelerator
  • Refering to the class itself from within a class mehod in Objective C
  • How to create a file in java without a extension
  • Spark fat jar to run multiple versions on YARN
  • formatting the colorbar ticklabels with SymLogNorm normalization in matplotlib
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • Deleting and Updating values from a cusrsor adapter
  • Is possible to count alias result on mysql
  • Modifying destination and filename of gulp-svg-sprite
  • MySQL WHERE-condition in procedure ignored
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • ActionScript 2 vs ActionScript 3 performance
  • json Serialization in asp
  • Benchmarking RAM performance - UWP and C#
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • costura.fody for a dll that references another dll