diff options
author | Michael Koch <mkoch@gcc.gnu.org> | 2002-09-25 05:05:07 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2002-09-25 05:05:07 +0000 |
commit | ed08cfe4cd05b81e9dbdf33866c8e292a424fb67 (patch) | |
tree | 39ea9a29a7413c3343fed19100ab8885a7a52d60 /libjava/java/net/MulticastSocket.java | |
parent | 95ddd785f615b57b28764a3466b9cb167512a414 (diff) | |
download | gcc-ed08cfe4cd05b81e9dbdf33866c8e292a424fb67.zip gcc-ed08cfe4cd05b81e9dbdf33866c8e292a424fb67.tar.gz gcc-ed08cfe4cd05b81e9dbdf33866c8e292a424fb67.tar.bz2 |
2002-09-25 Michael Koch <konqueror@gmx.de>
* java/net/DatagramPacket
(DatagramPacket): Exception documentation added.
(setData): Likewise.
(setSocketAddress): Likewise.
* java/net/DatagramSocketImpl.java
(peek): Documentation addded.
(peekData): Documentation addded.
(send): Documentation addded.
(receive): Documentation addded.
(connect): New method.
(disconnect): New method.
(joinGroup): New abstract method.
(leaveGroup): New abstract method.
* java/net/InetSocketAddress.java
(InetSocketAddress): Documentation added.
(equals): final keyword added.
(getAddress): final keyword added.
(getHostName): final keyword added.
(getPort): final keyword added.
(hashCode): final keyword added.
(isUnresolved): final keyword added.
* java/net/MulticastSocket.java
(MulticastSocket): Documentation added.
(MulticastSocket): New method.
(joinGroup): Documentation added.
(joinGroup): New method.
(leaveGroup): Documentation added.
(leaveGroup): New method.
(send): Documentation added.
* java/net/NetworkInterface.java
(getByName): Documentation added.
(getByInetAddress): Documentation added.
(getNetworkInterfaces): Documentation added.
* java/net/PlainDatagramSocketImpl.java
(connect): New method.
(disconnect): New method.
* java/net/SocketImpl.java
(create): Documentation added.
(shutdownInput): Convert public to protected, as it always was.
(shutdownOutput): Convert public to protected, as it always was.
* java/net/SocketOptions.java
(whole file): Reintented.
* java/net/URLClassLoader.java
(URLClassLoader): SecurityManager check added, documentation added.
(findResources): Documentation added.
(findClass): Documentation added.
(newInstance): More correct method arguments.
* java/net/URLConnection.java
(connect): Documentation added.
(getContent): Documentation added.
(getPermission): Documentation added.
(getInputStream): Documentation added.
(getOutputStream): Documentation added.
(setDoInput): Throw correct exception, documentation added.
(setDoOutput): Throw correct exception, documentation added.
(setAllowUserInteraction): Throw correct exception, documentation added.
(setUseCaches): Throw correct exception, documentation added.
(setIfModifiedSince): Throw correct exception, documentation added.
(setRequestProperty): Throw exception, documentation added.
(addRequestProperty): Throw exception, documentation added.
(getRequestProperty): Throw exception, documentation added.
(getRequestProperties): Documentation added.
(setContentHandlerFactory): Documentation added.
(guessContentTypeFromName): protected to public.
(setFileNameMap): Documentation added.
* java/net/URLDecoder.java
(URLDecoder): New method.
(decode): Documentation added.
(whole file): Reindented.
* java/net/URLEncoder.java
(encode): Documentation added.
* java/net/natPlainDatagramSocketImpl.cc
(connect): New method.
(disconnect): New method.
* javax/naming/RefAddr:
(addrType): addrType was never final.
(equals): Fix typo in method name.
* javax/naming/BinaryRefAddr:
(equals): Fix typo in method name.
From-SVN: r57487
Diffstat (limited to 'libjava/java/net/MulticastSocket.java')
-rw-r--r-- | libjava/java/net/MulticastSocket.java | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index 88cb149..b358260 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -73,6 +73,8 @@ public class MulticastSocket extends DatagramSocket * Create a MulticastSocket that this not bound to any address * * @exception IOException If an error occurs + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation */ public MulticastSocket() throws IOException { @@ -85,6 +87,8 @@ public class MulticastSocket extends DatagramSocket * @param port The port to bind to * * @exception IOException If an error occurs + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation */ public MulticastSocket(int port) throws IOException { @@ -92,6 +96,22 @@ public class MulticastSocket extends DatagramSocket } /** + * Create a multicast socket bound to the specified SocketAddress. + * + * @param address The SocketAddress the multicast socket will be bound to + * + * @exception IOException If an error occurs + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation + * + * @since 1.4 + */ + public MulticastSocket(SocketAddress address) throws IOException + { + super(address); + } + + /** * Returns the interface being used for multicast packets * * @return The multicast interface @@ -232,6 +252,7 @@ public class MulticastSocket extends DatagramSocket * @param addr The address of the group to join * * @exception IOException If an error occurs + * @exception SecurityException FIXME */ public void joinGroup(InetAddress mcastaddr) throws IOException { @@ -251,6 +272,7 @@ public class MulticastSocket extends DatagramSocket * @param addr The address of the group to leave * * @exception IOException If an error occurs + * @exception SecurityException FIXME */ public void leaveGroup(InetAddress mcastaddr) throws IOException { @@ -265,6 +287,74 @@ public class MulticastSocket extends DatagramSocket } /** + * Joins the specified mulitcast group on a specified interface. + * + * @param mcastaddr The multicast address to join + * @param netIf The local network interface to receive the multicast + * messages on or null to defer the interface set by #setInterface or + * #setNetworkInterface + * + * @exception IOException If an error occurs + * @exception IllegalArgumentException If address type is not supported + * @exception SecurityException FIXME + * + * @see MulticastSocket:setInterface + * @see MulticastSocket:setNetworkInterface + * + * @since 1.4 + */ + public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) + throws IOException + { + if (! (mcastaddr instanceof InetSocketAddress)) + throw new IllegalArgumentException ("SocketAddress type not supported"); + + InetSocketAddress tmp = (InetSocketAddress) mcastaddr; + + if (! tmp.getAddress ().isMulticastAddress ()) + throw new IOException ("Not a Multicast address"); + + // FIXME: check if this check is sufficient. Do we need to check the port ? + SecurityManager s = System.getSecurityManager (); + if (s != null) + s.checkMulticast (tmp.getAddress ()); + + impl.joinGroup (mcastaddr, netIf); + } + + /** + * Leaves the specified mulitcast group on a specified interface. + * + * @param mcastaddr The multicast address to leave + * @param netIf The local networki interface or null to defer to the + * interface set by setInterface or setNetworkInterface + * + * @exception IOException If an error occurs + * @exception IllegalArgumentException If address type is not supported + * @exception SecurityException FIXME + * + * @see MulticastSocket:setInterface + * @see MulticastSocket:setNetworkInterface + * + * @since 1.4 + */ + public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) + throws IOException + { + InetSocketAddress tmp = (InetSocketAddress) mcastaddr; + + if (! tmp.getAddress ().isMulticastAddress ()) + throw new IOException ("Not a Multicast address"); + + // FIXME: do we need to check the port too, or is this sufficient ? + SecurityManager s = System.getSecurityManager (); + if (s != null) + s.checkMulticast (tmp.getAddress ()); + + impl.leaveGroup (mcastaddr, netIf); + } + + /** * Sends a packet of data to a multicast address with a TTL that is * different from the default TTL on this socket. The default TTL for * the socket is not changed. @@ -273,6 +363,7 @@ public class MulticastSocket extends DatagramSocket * @param ttl The TTL for this packet * * @exception IOException If an error occurs + * @exception SecurityException FIXME */ public synchronized void send(DatagramPacket p, byte ttl) throws IOException { |