title: Hostname discovery for all machines on a network
body: <p><strong>Problem</strong>: I am developing a graphical front end for a distributed CPU/GPU simulator. As this simulator utilizes MPI, it requires a hostfile detailing the hostnames for all computers being used on the network so that it knows what machines to distribute across. As the end users for my application are not computer scientists (and may not even be very computer literate), I can't expect them to know/find the hostnames of every computer on their network/cluster. I would like to programmatically perform this hostname discovery so that, upon application start-up, the user can see the available machines, and from those, pick the hosts they want to run on. If possible, I would like this solution to be cross platform but as the simulator currently contains some linux dependencies I can deal with a Linux only solution.</p>
  
  <p><strong>What I have tried so far</strong>: I tried utilizing the nmap package to discover hosts on a network with commands like <code>nmap -sP &lt;ip address range&gt;</code> using the ip address range for that local network. However, it only dumps the IP addresses for the hosts (not the host names) and <strong>I'm not sure how to translate these IP addresses into ssh hostnames</strong> (as MPI uses ssh for  host discovery). Additionally, I used a similar approach with ping supplying the broadcast address and it returned nearly identical results.</p>
  
  <p>I apologize for the broad nature of this question and the lack of code shown but I am not very experienced with network probing / programming and I am really not even sure where to start. I tried googling this but I was unable to find a suitable option (possibly because my lack of experience caused me to use improper terminology triggering improper results) My background is primarily in graphics and user interface programming, so this is a little beyond my comfort zone. </p>