Yes, that much is clear.guylouis wrote: ↑Sat Oct 07, 2017 12:05 pmI think you don't really understand my problem...FourthWorld wrote: ↑Thu Oct 05, 2017 11:43 pmI think I didn't pose my question clearly: why use the IP address at all? Why not make the server calls using the domain name?
After reading your post it seems we could rephrase the question as:
"How can I implement auto-discovery of other devices on the local network?"
Is that correct?
If so, the answer is not straightforward. Indeed, this is why discovery protocols like Bonjour were established, to account for the many factors that can make discovery difficult.
localHost is designed for loopback, allowing for socket connections between processes on the same machine. In some cases (as apparently with your Mac and Windows boxes) the localHost address may be the same as the local network address. But in other cases it may differ. For example, on my Linux box here localHost gives me the loopback address ("127.0.0.1").
In short, localHost is not the answer. In fact, if there's a bug to report it may be that Mac and Win versions of LC may not be properly reporting localhost, since 127.0.0.1 is most common.
For discovery, in some cases you may be able to make a UDP broadcast. For that to work you would need to make sure the tablet is using wifi rather than a external cellular network, and that the wifi router is configured to allow UDP, and that software firewalls on the PCs will allow UDP.
This pair of stacks may help with implementing a UDP broadcast solution:
http://www.tweedly.org/showpage.lc?page=samples
However, apparently not all systems allow UDP broadcast:
viewtopic.php?f=11&t=8176#p38711
Most commonly this problem is solved with an intermediary server to facilitate dynamic DNS, but since your environment doesn't have Internet access that's a no-go.
Maybe the simplest solution can be based on that constraint: because there is no Internet all devices use DHCP from one router, so you may be able to loop through a fairly small number of addresses based on common router defaults. Most will use 192.168.1-254 (255 is usually reserved), with fewer defaulting to 192.168.0-254, and a very small number that default to 10.1.1/24 or 10.0.0/24.
If this is a system you manage you can set the range in your router, though yours is apparently already using the most common range.
If this is a system you want to deliver for others to use with their own routers, and that customer base is not expected to be able to know how to set their router's DHCP range, you may extend your loop to try the other ranges in succession.
But I'd wager you'll get 99% of devices found easily just looping in one range, from 192.168.1.0 to 192.168.1.254.