< prev index next >

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

Print this page
rev 57619 : [mq]: MulticastSocketAdaptor

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -27,10 +27,11 @@
 
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.Set;
+
 /**
  * The multicast datagram socket class is useful for sending
  * and receiving IP multicast packets. A MulticastSocket is
  * a (UDP) DatagramSocket, with additional capabilities for
  * joining "groups" of other multicast hosts on the internet.

@@ -206,10 +207,14 @@
      * @since 1.4
      */
     public MulticastSocket(SocketAddress bindaddr) throws IOException {
         super((SocketAddress) null);
 
+        // No further initialization when this is a DatagramChannel socket adaptor
+        if (this instanceof sun.nio.ch.DatagramSocketAdaptor)
+            return;
+
         // Enable SO_REUSEADDR before binding
         setReuseAddress(true);
 
         if (bindaddr != null) {
             try {
< prev index next >