Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't see hostname on LAN device
    primarykey
    data
    text
    <p>I am trying to get my Android 2.3.5 phone to list all of the possible Raspberry Pis (running Raspbian) on my LAN network. There are other devices on the network, so the way I thought to go about doing this, in pseudo code, was:</p> <pre><code>foreach ip 0..254 hn = gethostname("192.168.0." + ip); if(hn == "rpi*") { do_something(); } </code></pre> <p>I have successfully set the hostname of the RPi with:</p> <pre><code>sudo hostname rpi0 </code></pre> <p>My router shows that the RPi is connected to <code>192.168.0.4</code>. I am able to <code>ping</code> the ip address <code>192.168.0.4</code> from my Win7 PC, however I cannot <code>ping</code> the hostname, or <code>nslookup</code> the ip or hostname.</p> <p>When I try the code below in java on my phone, it claims it is reachable, but the get hostname line returns the ip address rather than the hostname, which I think it is supposed to do if it cannot find a hostname:</p> <pre><code>InetAddress inetAddress = InetAddress.getByAddress(ipAddress); Log.d(TAG, inetAddress.isReachable(5000)); Log.d(TAG, inetAddress.getHostName()); </code></pre> <p>Does anyone know what I am doing wrong? Is this even a sane way to go about finding all of one type of device on a LAN? If so, I am fairly sure that I have the android side of things correct, but I don't know that much about LANs. </p> <p>PS sorry if this question is long and convoluted, I wanted to include everything I had tried. Also I am using a Virgin Superhub that claims:</p> <pre><code>Software version "R36" Hardware version 2.00 </code></pre> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload