Hi, the appended patch implements getTimeToLive & setTimeToLive methods for java.net.MulticastSocket. The implementation just calls the getTTL & setTTL methods. The implementation of setTimeToLive additionally checks if the given time to live is within bounds specified in Java Class Libraries Second Edition Volume 1 Supplement book. If it is not, it throws an IllegalArgumentException, like JDK does.
Additionally, I deprecated the old forms (getTTL, setTTL), since they are marked as deprecated as of Java 1.2. have fun, Dalibor Topic
* libraries/javalib/java/net/MulticastSocket.java: (getTimeToLive) new method. (getTTL) deprecated. (setTimeToLive) new method. (setTTL) deprecated.
--- kaffe/libraries/javalib/java/net/MulticastSocket.java Mon Feb 8 19:58:10 1999 +++ patched-kaffe/libraries/javalib/java/net/MulticastSocket.java Mon Mar 18 14:36:38 2002 @@ -35,6 +35,13 @@ return (iface); } +public int getTimeToLive() throws IOException { + return getTTL(); +} + +/** + * @deprecated. + */ public byte getTTL() throws IOException { return (impl.getTTL()); } @@ -58,6 +65,17 @@ iface = inf; } +public void setTimeToLive(int ttl) throws IOException { + if (ttl < 0 || ttl > 255) { + throw new IllegalArgumentException("ttl out of range"); + } + + setTTL((byte) ttl); +} + +/** + * @deprecated. + */ public void setTTL(byte ttl) throws IOException { impl.setTTL(ttl); }