How do I find all the devices connected to my home network using Android?
<p>As part of a project I'm building an app that maps the home network, I found the following code but I can not find help all devices which are connected to the network (IP addresses).</p>

<pre><code>protected String doInBackground(String... aurl) {
    LoopCurrentIP = 0;

    String IPAddress = "";
    String[] myIPArray = aurl[0].split("\\.");
    InetAddress currentPingAddr;

    for (int i = 0; i &lt;= 255; i++) {
        try {
            // build the next IP address
            currentPingAddr = InetAddress.getByName(myIPArray[0] + "." +
                    myIPArray[1] + "." +
                    myIPArray[2] + "." +
                    Integer.toString(LoopCurrentIP));
            IPAddress = currentPingAddr.toString();
            publishProgress(""+(int)((i*100)/255));                         
            Log.d("MyApp",IPAddress);  

            // 50ms Timeout for the "ping"
            if (currentPingAddr.isReachable(1000)) {
                textView.setText(currentPingAddr.toString());
                ret.add(currentPingAddr);

                Log.d("MyApp",IPAddress);                     
            }
        } catch (UnknownHostException ex) {
        } catch (IOException ex) {
        }

        LoopCurrentIP++;
    }

    return null;
}
</code></pre>
