1

My Android Phone is connected to a LAN.

There is a way in Java to get the list of LAN IPs?

I would like to get this list because my app has to connect to a SQL Server on a LAN Machine to syncronize some datas.

Could someone help me?

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Je8
  • 13
  • 1
  • 5
  • You probably already know about [find-sql-servers-on-your-network](http://www.mssqltips.com/sqlservertip/1113/find-sql-servers-on-your-network-with-osql-and-sqlcmd). Don't how to do that on Android. – Miserable Variable Oct 06 '11 at 10:19
  • See also http://stackoverflow.com/questions/16326508/getting-all-local-ips-arp-a – Raedwald Oct 22 '13 at 19:16

2 Answers2

1

You can try to launch a shell command from your Java application: nmap 192.168.1.*

But I haven't tryied!

Luca Davanzo
  • 21,000
  • 15
  • 120
  • 146
0

There isn't, but there are ways to advertise/locate a service without knowing the IP address. Look for zeroconf (what Apple calls bonjour). Microsoft has an alternative, UPNP.

Most apps seem to give up and simply ask the user to type in the IP address.

arnt
  • 8,949
  • 5
  • 24
  • 32