jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
changeset 12890 6bac93e59597
parent 12891 5dbaa8f0f72e
parent 12889 3ecbb4f2b752
child 14025 fbebe005a3ee
equal deleted inserted replaced
12841:c5ca850e1dff 12890:6bac93e59597
   661                     ensureOpen();
   661                     ensureOpen();
   662                     if (localAddress != null)
   662                     if (localAddress != null)
   663                         throw new AlreadyBoundException();
   663                         throw new AlreadyBoundException();
   664                     InetSocketAddress isa;
   664                     InetSocketAddress isa;
   665                     if (local == null) {
   665                     if (local == null) {
   666                         isa = new InetSocketAddress(0);
   666                         // only Inet4Address allowed with IPv4 socket
       
   667                         if (family == StandardProtocolFamily.INET) {
       
   668                             isa = new InetSocketAddress(InetAddress.getByName("0.0.0.0"), 0);
       
   669                         } else {
       
   670                             isa = new InetSocketAddress(0);
       
   671                         }
   667                     } else {
   672                     } else {
   668                         isa = Net.checkAddress(local);
   673                         isa = Net.checkAddress(local);
   669 
   674 
   670                         // only Inet4Address allowed with IPv4 socket
   675                         // only Inet4Address allowed with IPv4 socket
   671                         if (family == StandardProtocolFamily.INET) {
   676                         if (family == StandardProtocolFamily.INET) {