From 7b98d4549b34d8fe57170ce9fb57f2c1508516dc Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Wed, 4 Sep 2002 17:35:22 +0000 Subject: 2002-09-04 Michael Koch * java/net/DatagramSocket.java (DatagramSocket): Added documentation. (close): Likewise. (getLocalAddress): Likewise. (getLocalPort): Likewise. (receive): Likewise. (send): Likewise. (setSoTimeout): Likewise. (connect): New method. (disconnect): New method. (getInetAddress): New method (FIXME) (getPort): New method. (setReuseAddress): New method. (getReuseAddress): New method. (setBroadcast): New method. (getBroadcast): New method. (setTrafficClass): New method. (getTrafficClass): New method. * java/net/MulticastSocket.java): (getTTL): Added @see in documentation. (setTTL): Added @see in documentation. (setLoopbackMode): New method. (getLoopbackMode): New method. * java/net/PlainSocketImpl.java: Added new constants for the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS * java/net/PlainDatagramSocketImpl.java Added new constants for the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS * java/net/natPlainSocketImpl.cc (getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS (setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS This should also fix SO_KEEPALIVE * java/net/natPlainDatagramSocketImpl.cc (getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS (setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS From-SVN: r56801 --- libjava/java/net/MulticastSocket.java | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'libjava/java/net/MulticastSocket.java') diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index 54ed5c1..88cb149 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -114,6 +114,8 @@ public class MulticastSocket extends DatagramSocket * @exception IOException If an error occurs * * @deprecated 1.2 Replaced by getTimeToLive() + * + * @see Multicastsocket:getTimeToLive */ public byte getTTL() throws IOException { @@ -151,6 +153,42 @@ public class MulticastSocket extends DatagramSocket } /** + * Disable/Enable local loopback of multicast packets. The option is used by + * the platform's networking code as a hint for setting whether multicast + * data will be looped back to the local socket. + * + * Because this option is a hint, applications that want to verify what + * loopback mode is set to should call #getLoopbackMode + * + * @param disable True to disable loopback mode + * + * @exception SocketException If an error occurs + * + * @since 1.4 + */ + public void setLoopbackMode(boolean disable) throws SocketException + { + impl.setOption (SocketOptions.IP_MULTICAST_LOOP, new Boolean (disable)); + } + + /** + * Checks if local loopback mode is enabled or not + * + * @exception SocketException If an error occurs + * + * @since 1.4 + */ + public boolean getLoopbackMode() throws SocketException + { + Object obj = impl.getOption (SocketOptions.IP_MULTICAST_LOOP); + + if (obj instanceof Boolean) + return ((Boolean) obj).booleanValue (); + else + throw new SocketException ("Unexpected type"); + } + + /** * Sets the "Time to Live" value for a socket. The value must be between * 1 and 255. * @@ -159,6 +197,8 @@ public class MulticastSocket extends DatagramSocket * @exception IOException If an error occurs * * @deprecated 1.2 Replaced by setTimeToLive + * + * @see MulticastSocket:setTimeToLive */ public void setTTL(byte ttl) throws IOException { -- cgit v1.1