Harold
Harold

Reputation: 1166

Find an application running on a network

I'm new to networking and was wondering a way to find out from an android phone java app whether there is an application running on any computer on a wifi network it's connected to and a point in the right direction on what to google or a tutorial?

edit: The application I'd be finding would have been made to be found by the android app

Thanks, Harold

Upvotes: 0

Views: 326

Answers (2)

Gryphius
Gryphius

Reputation: 78886

usually application discover their peers in the same network using UDP broadcasts, maybe thats what you are looking for. this requires the app on the lan to listen on a specified port, the phone (or whoever is looking for that app) sends a udp packet to that port on the broadcast address (255.255.255.255), and the app replies with its individual ip address. not sure if that is what you are looking for and if its possible with android

Upvotes: 0

Chris Dennett
Chris Dennett

Reputation: 22721

You should use a UDP broadcast. Basically, a server announces its presence periodically on a local network with broadcast packets. A client then picks up on these packets, finds the source and connects to it. A networking library like KryoNet (available for both J2SE and Android Java) makes it much easier.

InetAddress address = client.discoverHost(54777, 5000);
System.out.println(address);

Upvotes: 1

Related Questions