Search in sources :

Example 1 with NetworkTopologyEventImpl

use of javax.jmdns.impl.NetworkTopologyEventImpl in project JAirPort by froks.

the class JAirPort method main.

public static void main(String[] args) throws Exception {
    Runtime.getRuntime().addShutdownHook(new ShutdownThread());
    String hwAddr = Utils.byteAddrToString(Configuration.getHardwareAddress());
    String host = Configuration.getHostName();
    String name = hwAddr + "@JAirPort on " + host;
    int port = Configuration.getPort();
    // Announce Raop Service
    ServiceInfo info = ServiceInfo.create(name + "._raop._tcp.local", name, port, "tp=UDP sm=false sv=false ek=1 et=0,1 cn=0,1 ch=2 ss=16 sr=44100 pw=false vn=3 txtvers=1");
    dns = JmmDNS.Factory.getInstance();
    ((JmmDNSImpl) dns).inetAddressAdded(new NetworkTopologyEventImpl(JmDNS.create(InetAddress.getByName("localhost")), InetAddress.getByName("localhost")));
    // If this isn't done the Announcement sometimes doesn't go out on the local interface
    Thread.sleep(1000);
    dns.registerService(info);
    System.out.println("Service registered");
    // Start RtspServer
    RtspServer server = new RtspServer(port);
    serverThread = new Thread(server, "RtspServer");
    serverThread.setDaemon(false);
    serverThread.start();
    serverThread.join();
}
Also used : ServiceInfo(javax.jmdns.ServiceInfo) NetworkTopologyEventImpl(javax.jmdns.impl.NetworkTopologyEventImpl) JmmDNSImpl(javax.jmdns.impl.JmmDNSImpl)

Aggregations

ServiceInfo (javax.jmdns.ServiceInfo)1 JmmDNSImpl (javax.jmdns.impl.JmmDNSImpl)1 NetworkTopologyEventImpl (javax.jmdns.impl.NetworkTopologyEventImpl)1