[PATCH] MulticastSocket [gs]etTimeToLive implementation
Dalibor Topic
kaffe@rufus.w3.org
Mon, 18 Mar 2002 15:18:56 +0100
--------------Boundary-00=_KFA6K8X8YHVXQ65FJDC9
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
the appended patch implements getTimeToLive & setTimeToLive methods for=20
java.net.MulticastSocket. The implementation just calls the getTTL & setT=
TL=20
methods. The implementation of setTimeToLive additionally checks if the g=
iven=20
time to live is within bounds specified in Java Class Libraries Second=20
Edition Volume 1 Supplement book. If it is not, it throws an=20
IllegalArgumentException, like JDK does.
Additionally, I deprecated the old forms (getTTL, setTTL), since they are=
=20
marked as deprecated as of Java 1.2.
have fun,
Dalibor Topic
--------------Boundary-00=_KFA6K8X8YHVXQ65FJDC9
Content-Type: text/plain;
charset="us-ascii";
name="ChangeLog"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="ChangeLog"
* libraries/javalib/java/net/MulticastSocket.java:
(getTimeToLive) new method.
(getTTL) deprecated.
(setTimeToLive) new method.
(setTTL) deprecated.
--------------Boundary-00=_KFA6K8X8YHVXQ65FJDC9
Content-Type: text/x-diff;
charset="us-ascii";
name="java.net.MulticastSocket-TimeToLive.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="java.net.MulticastSocket-TimeToLive.patch"
--- 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);
}
--------------Boundary-00=_KFA6K8X8YHVXQ65FJDC9--
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com