views:

115

answers:

2

I am looking for a way for clients in a LAN to find all the instances of my server application without any configuration. Instead of hacking something myself, I'd like to use an existing solution. Personally, I need it to be done in Python, but I'd happy to hear about solutions in any other language.

So why am I not using avahi or OpenSLP or some other Zeroconf/SLP solution? Well, there are a couple of additional criteria, and I'm under the impression neither of the aforementioned systems matches them.

I'm looking for a solution that is:

  • Flexible. It must not require superuser rights, i.e. only use ports>1024.
  • Solid. It must allow multiple services of the same and different service type on a single machine and continue advertising the services even when the instance that started the advertisement server stops or crashes.
  • Portable. It must run nearly everywhere, or at least on *BSD, Debian/gentoo/RedHat/SuSe Linux, Mac OS X, Solaris and Windows NT.
  • Light. Ideally, one Python script would be the whole solution. I'm not in the least interested in address autoconfiguration or something like that, although I'd begrudgingly accept a solution that has lots of features I don't need. Furthermore, any one-time setup is a strict no-no.

I expect something like this:

def registerService(service): # (type, port)
    if listen(multicast, someport):
     if fork() == child:
      services = [service]
      for q in queriesToMe():
       if q == DISCOVERY:
        answer(filter(q.criteria, services))
       elif q == ADVERTISE and q.sender == "localhost":
        services.append(q.service)
    else:
     advertiseAt("localhost", service)
+1  A: 

I assume you have control over the client apps, not just the server app, in which case Pyro might work well for you.

Flexible: uses non privileged ports.

Solid: It has been well maintained for many years.

Portable: pure Python and well tested on multiple platforms.

Light: I think Pyro is light for what you're getting. Maybe asking for one Python script is unrealistic for a network naming service?

Even if you don't want to actually use the "remote object" paradigm of Pyro, you still might be able to just use its naming service.

Van Gale
Pyro looks great, but fails to meet some requirements I slid into "Solid": It uses a central server to store the advertisements so that the whole network keels over as soon as I separate the central server subnet. Plus, it's incredible powerful and therefore not exactly light. And broadcast is ugly.
phihag
(I suspect the real problem is I'm too demanding)
phihag
A: 

I wrote an application/library (currently Python and CLI interface) that matches all these critera. It's called minusconf. Turns out forking is not even necessary.

phihag