views:

126

answers:

5

I have a network of 16 computers all linked to the same switch, not connected to the internet. One of the 16 computers has a small Java app running on it along with a BlazeDS server (aka it's listening on a port for a message).

Currently, the other 15 "client" computers have to manually enter the "server" IP where the java app resides. My client app is Adobe Air, so I have no abilities there as far as scanning for the server.

I was thinking of writing a helper app / utility in Java or C++. At the very least, this app could display the IP to the user who could then input it into the Air app; sloppy but better than nothing.

I'm sure there are some tools out there that deal with this type of problem. Any ideas?

+1  A: 

In a word, nmap. You can tell it to scan a netblock

$ nmap -P0 10.104.244.200

Starting Nmap 4.20 ( http://insecure.org ) at 2010-02-19 18:02 Eastern Standard Time
Interesting ports on BOSA638992.fmrco.com (10.104.244.200):
Not shown: 1688 closed ports
PORT     STATE SERVICE
25/tcp   open  smtp
80/tcp   open  http
135/tcp  open  msrpc
139/tcp  open  netbios-ssn
371/tcp  open  clearcase
443/tcp  open  https
445/tcp  open  microsoft-ds
2030/tcp open  device2
3389/tcp open  ms-term-serv
MAC Address: 00:17:A4:F3:6D:A7 (Global Data Services)

Nmap finished: 1 IP address (1 host up) scanned in 1.750 seconds

See http://nmap.org/

unhillbilly
interesting. supposed they go out an buy a new switch though. they might move from 10.0.0.x to 192.168.0.x, right?
Stephano
Hmm. You mean that your service moved, right? Does the server have a DNS name? If so use that. If there is no DNS, maybe query DHCP server for leased numbers?
unhillbilly
Ah, I'm afraid I'm DNS and DHCP server-less. Just the computers and the switch. I'm thinking zeroConf might be the way to go here.
Stephano
Reading above, ZeroConf/Bonjour via AIR native looks real good.
unhillbilly
+1  A: 

Adobe AIR 2.0 (available as Beta) has the ability to communicate with native processes. See http://www.adobe.com/devnet/air/flex/quickstart/interacting_with_native_process.html

You can use this facility to call a helper that you write and ship with your app. This helper would use some means of discovering your server. For instance zeroConf Networking (called Bonjour by Apple). Your AIR app would than use the address it received from the helper to make a connection to the server.

VoidPointer
+1 Yes, I am quite excited about this, among other 2.0 features. I'm looking for something to use in the mean time however, as we'll be releasing before 2.0.
Stephano
+2  A: 

You could code a "discover" feature for the users that sends a heartbeat or test message to all the IP addresses in the same subnet of the current computer looking for the server that accepts / responds appropriately.

smokeysonora
That was certainly my first thought as well. I could just start at the bottom of the subnet and work my way up. I would just have to hope they weren't too far away. Still, I'm thinking zeroConf might be a bit harder but much more accurate.
Stephano
yeah it's a bit low tech, it all depends on the size of the subnet you're on, but even at it's most you're talking about 253 pings. but you are correct that the best solution is probable zeroConf or another form of dns / named server.
smokeysonora
+1  A: 

multicast would work - how about http://www.jgroups.org if you are happy with java

pm100
+4  A: 

I would strongly recommend using Zeroconf/Bonjour for this as it makes it trivially easy to handle decentralized "where is the others who I should know about and should know about me"?

The easiest way to do this in Java (and completely inside your own application) is with the jmdns project. http://jmdns.sourceforge.net/

Thorbjørn Ravn Andersen
+1 Thanks for the hint about jmdns. Found this as well: http://stackoverflow.com/questions/1233204/are-there-any-other-java-libraries-for-bonjour-zeroconf-apart-from-jmdns
Stephano