/[classpath]/classpath/java/net/MulticastSocket.java
ViewVC logotype

Diff of /classpath/java/net/MulticastSocket.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by mkoch, Sat Nov 23 10:29:28 2002 UTC revision 1.15 by mkoch, Thu Dec 19 10:29:44 2002 UTC
# Line 161  public class MulticastSocket extends Dat Line 161  public class MulticastSocket extends Dat
161    }    }
162    
163    /**    /**
164       * Sets the interface to use for sending multicast packets.
165       *
166       * @param addr The new interface to use.
167       *
168       * @exception SocketException If an error occurs.
169       *
170       * @since 1.4
171       */
172      public void setInterface(InetAddress inf) throws SocketException
173      {
174        impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);
175      }
176    
177      /**
178     * Sets the local network interface used to send multicast messages     * Sets the local network interface used to send multicast messages
179     *     *
180     * @param netIF The local network interface used to send multicast messages     * @param netIF The local network interface used to send multicast messages
# Line 213  public class MulticastSocket extends Dat Line 227  public class MulticastSocket extends Dat
227    }    }
228    
229    /**    /**
230     * Sets the interface to use for multicast packets.     * Disable/Enable local loopback of multicast packets.  The option is used by
231       * the platform's networking code as a hint for setting whether multicast
232       * data will be looped back to the local socket.
233     *     *
234     * @param addr The new interface to use     * Because this option is a hint, applications that want to verify what
235       * loopback mode is set to should call #getLoopbackMode
236       *
237       * @param disable True to disable loopback mode
238     *     *
239     * @exception SocketException If an error occurs     * @exception SocketException If an error occurs
240     *     *
241     * @since 1.4     * @since 1.4
242     */     */
243    public void setInterface(InetAddress inf) throws SocketException    public void setLoopbackMode(boolean disable) throws SocketException
244    {    {
245      impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);      if (impl == null)
246          throw new SocketException (
247                          "MulticastSocket: Cant access socket implementation");
248    
249        impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable));
250      }
251    
252      /**
253       * Checks if local loopback mode is enabled or not
254       *
255       * @exception SocketException If an error occurs
256       *
257       * @since 1.4
258       */
259      public boolean getLoopbackMode() throws SocketException
260      {
261        Object obj = impl.getOption (SocketOptions.IP_MULTICAST_LOOP);
262    
263        if (obj instanceof Boolean)
264          return ((Boolean) obj).booleanValue ();
265        else
266          throw new SocketException ("Unexpected type");
267    }    }
268    
269    /**    /**

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26