2003-06-08 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Sun, 8 Jun 2003 09:25:54 +0000 (09:25 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Sun, 8 Jun 2003 09:25:54 +0000 (09:25 +0000)
* java/net/DatagramSocket.java
(DatagramSocket): No need to set SO_REUSEADDRESS here. This belongs
into the Multicast constructors.
* java/net/DatagramSocketImpl.java
(getOption): Removed.
(setOption): Removed.
* java/net/MulticastSocket.java
(MulticastSocket): Call setReuseAddress (true).
* java/net/SocketImpl.java
(getOption): Removed.
(setOption): Removed.

From-SVN: r67617

libjava/ChangeLog
libjava/java/net/DatagramSocket.java
libjava/java/net/DatagramSocketImpl.java
libjava/java/net/MulticastSocket.java
libjava/java/net/SocketImpl.java

index 0d086a7cb86cd8f97c2a1f78377b5893ff61582f..815a1706fd1ef15d08f7470f93b8b5b725df13f2 100644 (file)
@@ -1,3 +1,17 @@
+2003-06-08  Michael Koch  <konqueror@gmx.de>
+
+       * java/net/DatagramSocket.java
+       (DatagramSocket): No need to set SO_REUSEADDRESS here. This belongs
+       into the Multicast constructors.
+       * java/net/DatagramSocketImpl.java
+       (getOption): Removed.
+       (setOption): Removed.
+       * java/net/MulticastSocket.java
+       (MulticastSocket): Call setReuseAddress (true).
+       * java/net/SocketImpl.java
+       (getOption): Removed.
+       (setOption): Removed.
+
 2003-06-07     Jeff Sturm      <jsturm@one-point.com>
 
        PR libgcj/10886:
index d300f20df92ae169a35b58c6a29527272187d846..e21ea44e1b4a9aa526a3502b1c37ed1ab88b7646 100644 (file)
@@ -174,9 +174,6 @@ public class DatagramSocket
        }
     impl.create();
 
-    // For multicasting, set the socket to be reused (Stevens pp. 195-6).
-    if (this instanceof MulticastSocket)
-      impl.setOption(SocketOptions.SO_REUSEADDR, new Boolean(true));
 
     impl.bind(port, laddr == null ? InetAddress.ANY_IF : laddr);
     
@@ -293,9 +290,6 @@ public class DatagramSocket
    */
   public int getLocalPort()
   {
-    if (!isBound ())
-      return -1;
-
     return impl.getLocalPort();
   }
 
index d225645a88a5b3db113eb1c1b2ba4e49fabe922e..891c8d183b5ec5e9c5da9c336fdd8eb8c9073aa6 100644 (file)
@@ -284,36 +284,4 @@ public abstract class DatagramSocketImpl implements SocketOptions
   {
     return localPort;
   }
-
-  /**
-   * Sets the specified option on a socket to the passed in object.  For
-   * options that take an integer argument, the passed in object is an
-   * <code>Integer</code>.  For options that are set to on or off, the
-   * value passed will be a <code>Boolean</code>.   The <code>optionId</code>
-   * parameter is one of the defined constants in the superinterface.
-   *
-   * @param optionId The identifier of the option
-   * @param val The value to set the option to
-   *
-   * @exception SocketException If an error occurs
-   * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
-   */
-  public abstract void setOption(int optionId, Object val)
-    throws SocketException;
-
-  /**
-   * Returns the current setting of the specified option.  The
-   * <code>Object</code> returned will be an <code>Integer</code> for options
-   * that have integer values.  For options that are set to on or off, a
-   * <code>Boolean</code> will be returned.   The <code>optionId</code>
-   * is one of the defined constants in the superinterface.
-   *
-   * @param optionId The option identifier
-   *
-   * @return The current value of the option
-   *
-   * @exception SocketException If an error occurs
-   * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
-   */
-  public abstract Object getOption(int option_id) throws SocketException;
 }
index a6dca948c8b76bba4df6c6635d1a24ee1f5191ce..1b7b422e07155c7d21af2a9575bfb2e6956f1442 100644 (file)
@@ -81,6 +81,7 @@ public class MulticastSocket extends DatagramSocket
   public MulticastSocket() throws IOException
   {
     super(0, null);
+    setReuseAddress (true);
   }
 
   /**
@@ -95,6 +96,7 @@ public class MulticastSocket extends DatagramSocket
   public MulticastSocket(int port) throws IOException
   {
     super(port, null);
+    setReuseAddress (true);
   }
 
   /**
@@ -111,6 +113,7 @@ public class MulticastSocket extends DatagramSocket
   public MulticastSocket(SocketAddress address) throws IOException
   {
     super(address);
+    setReuseAddress (true);
   }
   
   /**
index 12dcb0b9a5c72c383ccdfaea01caefa699c82566..25ffe91d1d2fe0356bc84f4993c787272802435f 100644 (file)
@@ -276,38 +276,6 @@ public abstract class SocketImpl implements SocketOptions
            + ",localport=" + localport + "]";
   }
 
-  /**
-   * Sets the specified option on a socket to the passed in object.  For
-   * options that take an integer argument, the passed in object is an
-   * <code>Integer</code>.  For options that are set to on or off, the
-   * value passed will be a <code>Boolean</code>.   The <code>option_id</code> 
-   * parameter is one of the defined constants in the superinterface.
-   *
-   * @param option_id The identifier of the option
-   * @param val The value to set the option to
-   *
-   * @exception SocketException If an error occurs
-   * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
-   */
-  public abstract void setOption(int option_id, Object val)
-    throws SocketException;
-
-  /**
-   * Returns the current setting of the specified option.  The 
-   * <code>Object</code> returned will be an <code>Integer</code> for options 
-   * that have integer values.  For options that are set to on or off, a 
-   * <code>Boolean</code> will be returned.   The <code>option_id</code>
-   * is one of the defined constants in the superinterface.
-   *
-   * @param option_id The option identifier
-   *
-   * @return The current value of the option
-   *
-   * @exception SocketException If an error occurs
-   * @XXX This redeclaration from SocketOptions is a workaround to a gcj bug.
-   */
-  public abstract Object getOption(int option_id) throws SocketException;
-
   /**
    * Shut down the input side of this socket.  Subsequent reads will
    * return end-of-file.