From: <jlg...@us...> - 2007-03-21 12:39:26
|
Revision: 98 http://trivial.svn.sourceforge.net/trivial/?rev=98&view=rev Author: jlgeering Date: 2007-03-21 05:39:09 -0700 (Wed, 21 Mar 2007) Log Message: ----------- Listen on all interfaces: new JmDNS(address); -> new JmDNS(); Removed all the interface selection code. Modified Paths: -------------- trunk/eclipse/easypaste/src/net/sf/trivial/easypaste/internal/pi/presence/PresenceServiceImpl.java Modified: trunk/eclipse/easypaste/src/net/sf/trivial/easypaste/internal/pi/presence/PresenceServiceImpl.java =================================================================== --- trunk/eclipse/easypaste/src/net/sf/trivial/easypaste/internal/pi/presence/PresenceServiceImpl.java 2007-03-21 12:33:38 UTC (rev 97) +++ trunk/eclipse/easypaste/src/net/sf/trivial/easypaste/internal/pi/presence/PresenceServiceImpl.java 2007-03-21 12:39:09 UTC (rev 98) @@ -1,7 +1,6 @@ package net.sf.trivial.easypaste.internal.pi.presence; import java.io.IOException; -import java.net.InetAddress; import java.net.NetworkInterface; import java.util.Enumeration; import java.util.Vector; @@ -18,7 +17,7 @@ public PresenceServiceImpl(int port, String serviceName) throws IOException { super(port, serviceName); - this.jmdns = createJmDNS(); + this.jmdns = new JmDNS(); this.serviceBrowser = new ServiceBrowserImpl(jmdns,this); this.serviceRegistrer = new ServiceRegistrerImpl(jmdns); } @@ -35,37 +34,4 @@ public ServiceRegistrer getServiceRegistrer() { return serviceRegistrer; } - - private JmDNS createJmDNS() throws IOException { - InetAddress finalAddress = null; - System.out.println("Starting service on the following interfaces:"); - try { - Vector<NetworkInterface> possibleValues = new Vector<NetworkInterface>(); - - Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); - while (interfaces.hasMoreElements()) { - possibleValues.add(interfaces.nextElement()); - } - - for (NetworkInterface ni : possibleValues) { - Enumeration<InetAddress> e = ni.getInetAddresses(); - while (e.hasMoreElements()) { - InetAddress ia = e.nextElement(); - if (!ia.isLoopbackAddress() && !ia.getHostAddress().contains(":")) { - finalAddress = ia; - System.out.println("\t" + ni.getDisplayName() - + "\t" + ia.getHostName() - + " (" + ia.getHostAddress() + ")"); - - } - } - } - } - catch (Exception e) { - e.printStackTrace(); - System.exit(1); - } - return new JmDNS(finalAddress); - } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |