Code Monkey home page Code Monkey logo

jmdns's Introduction

// %Z%%M%, %I%, %G%
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


//This library is now licensed under the Apache License Version 2.0  Please 
//see the file NOTICE.txt.  


Arthur van Hoff
[email protected]

Rick Blair
[email protected]

** JmDNS

This is an implemenation of multi-cast DNS in Java. It currently
supports service discovery and service registration. It is fully
interoperable with Apple's Rendezvous. 



** Requirements

jmdns has been tested using the JDK 1.3.1 and JDK 1.4.0
on the following platforms:

Windows 9x, XP, 2000
Linux   RedHat 7.3-9.0, Mandrake
Mac OSX



** Running jmdns from the Command Line

GUI browser:

  java -jar lib/jmdns.jar -browse

TTY browser for a particular service type:

  java -jar lib/jmdns.jar -bs _http._tcp local.

Register a service:

  java -jar lib/jmdns.jar -rs foobar _http._tcp local. 1234 path=index.html

List service types:

  java -jar lib/jmdns.jar -bt
  
To print debugging output specify -d as the first argument.  



** Sample Code for Service Registration

    import javax.jmdns.*;

    JmDNS jmdns = new JmDNS();
    jmdns.registerService(
    	new ServiceInfo("_http._tcp.local.", "foo._http._tcp.local.", 1234, 0, 0, "path=index.html")
    );


** Sample code for Serivice Discovery

    import javax.jmdns.*;

    static class SampleListener implements ServiceListener
    {
	public void addService(JmDNS jmdns, String type, String name)
	{
	    System.out.println("ADD: " + jmdns.getServiceInfo(type, name));
	}
	public void removeService(JmDNS jmdns, String type, String name)
	{
	    System.out.println("REMOVE: " + name);
	}
	public void resolveService(JmDNS jmdns, String type, String name, ServiceInfo info)
	{
	    System.out.println("RESOLVED: " + info);
	}
    }

    JmDNS jmdns = new JmDNS();
    jmdns.addServiceListener("_http._tcp.local.", new SampleListener());


** Changes since October 2003

- Renamed package com.strangeberry.rendezvous to javax.jmdns
- fixed unicast queries
- fixed property handling
- use the hostname instead of the service name is address resolution
- Added Apache License.

jmdns's People

Contributors

jadahl avatar

Watchers

 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.