< prev index next >

src/java.base/share/classes/java/net/MulticastSocket.java

Print this page

        

@@ -738,6 +738,31 @@
             }
             optionsSet = true;
             return options;
         }
     }
+
+    @Override
+    public synchronized boolean getReuseAddress() throws SocketException {
+        try {
+            return super.getReuseAddress() || getOption(StandardSocketOptions.SO_REUSEPORT);
+        } catch (IOException ex) {
+            SocketException se = new SocketException(ex.getMessage());
+            se.addSuppressed(ex);
+            throw se;
+        }
+    }
+
+    @Override
+    public synchronized void setReuseAddress(boolean on) throws SocketException {
+        super.setReuseAddress(on);
+        if (supportedOptions().contains(StandardSocketOptions.SO_REUSEPORT)) {
+            try {
+                setOption(StandardSocketOptions.SO_REUSEPORT, on);
+            } catch (IOException ex) {
+                SocketException se = new SocketException(ex.getMessage());
+                se.addSuppressed(ex);
+                throw se;
+            }
+        }
+    }
 }
< prev index next >