Git Product home page Git Product logo

cu-zeroconf's Introduction

CU-Zeroconf

CU-Zeroconf is a very simple Java implementation of Multicast DNS Service Discovery, aka the service discovery bit of Zeroconf. It was written in response to the authors unpublishable opinions on the only other existing pure-Java implementation at https://github.com/jmdns/jmdns, which claims to be correct. It may well be.

This implementation is not correct, but it tries to make up for that by being simple, documented and readable. It has been cobbled together in 8 hours from a skim read of one or two specifications and a glance at some implementations in other languages. It is certainly less fully-featured, as it currently only supports announcing new services, and it may not even do that properly. However it does successfully announce a service in a way that Zeroconf clients seem to recognise, on one or more local NetworkInterfaces, without immediately hanging, which for me at least is progress. It does this using a single Thread and a selector (from the java.nio.channels) package.

Here's a simple working example:

Zeroconf zeroconf = new Zeroconf();
zeroconf.addAllNetworkInterfaces();
Service service = zeroconf.newService("MyWeb", "http", 8080).putText("path", "/path/toservice").announce();
// time passes
service.cancel();
// time passes
zeroconf.close();

There is considerable room for improvement:

  • IPV6 is largely untested, although it appears to work.
  • There's no facility to search for services, just to announce them. However it's not a great leap to add this - the facility is there to create queries and receive responses.
  • The addition of a monitor class to track and automatically update Zeroconf objects with changes to NetworkInterface topology would be nice.
  • The responses to incoming queries are very simple, because I couldn't be bothered to read the spec to see how to do it properly. I think we should skip existing answers, but that's not implemented. We respond authoritively to queries for A and AAAA records that we have published as part of a Service announcement - I'm unsure if this is correct, but it doesn't seem to break anything,

To build

Run "ant". There are no external dependencies. Needs Java 7 or later, although only tested under Java 8

cu-zeroconf's People

Contributors

faceless2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.