< prev index next >
src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java
Print this page
@@ -29,10 +29,11 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import sun.net.ResourceManager;
+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
@@ -126,14 +127,16 @@
/**
* Binds a datagram socket to a local port.
*/
protected synchronized void bind(int lport, InetAddress laddr)
throws SocketException {
- bind0(lport, laddr);
+ int scopeId = IPAddressUtil.bindingScopeId(laddr);
+ assert laddr instanceof Inet4Address ? scopeId == -1 :true;
+ bind0(lport, laddr, scopeId);
}
- protected abstract void bind0(int lport, InetAddress laddr)
+ protected abstract void bind0(int lport, InetAddress laddr, int scopeId)
throws SocketException;
/**
* Sends a datagram packet. The packet contains the data and the
* destination address to send the packet to.
< prev index next >