< prev index next >

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

Print this page

        

@@ -31,11 +31,10 @@
 import java.util.Objects;
 import java.util.Set;
 
 import sun.net.ResourceManager;
 import sun.net.ext.ExtendedSocketOptions;
-import sun.net.util.IPAddressUtil;
 import sun.security.action.GetPropertyAction;
 
 /**
  * Abstract datagram and multicast socket implementation base class.
  * Note: This is not a public class, so that applets cannot call

@@ -109,13 +108,10 @@
     /**
      * Binds a datagram socket to a local port.
      */
     protected synchronized void bind(int lport, InetAddress laddr)
         throws SocketException {
-        if (laddr.isLinkLocalAddress()) {
-            laddr = IPAddressUtil.toScopedAddress(laddr);
-        }
         bind0(lport, laddr);
     }
 
     protected abstract void bind0(int lport, InetAddress laddr)
         throws SocketException;

@@ -123,35 +119,20 @@
     /**
      * Sends a datagram packet. The packet contains the data and the
      * destination address to send the packet to.
      * @param p the packet to be sent.
      */
-    protected void send(DatagramPacket p) throws IOException {
-        InetAddress orig = p.getAddress();
-        if (orig.isLinkLocalAddress()) {
-            InetAddress scoped = IPAddressUtil.toScopedAddress(orig);
-            if (orig != scoped) {
-                p = new DatagramPacket(p.getData(), p.getOffset(),
-                                       p.getLength(), scoped, p.getPort());
-            }
-        }
-        send0(p);
-    }
-
-    protected abstract void send0(DatagramPacket p) throws IOException;
+    protected abstract void send(DatagramPacket p) throws IOException;
 
     /**
      * Connects a datagram socket to a remote destination. This associates the remote
      * address with the local socket so that datagrams may only be sent to this destination
      * and received from this destination.
      * @param address the remote InetAddress to connect to
      * @param port the remote port number
      */
     protected void connect(InetAddress address, int port) throws SocketException {
-        if (address.isLinkLocalAddress()) {
-            address = IPAddressUtil.toScopedAddress(address);
-        }
         connect0(address, port);
         connectedAddress = address;
         connectedPort = port;
         connected = true;
     }
< prev index next >