Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6230761
Votes 26
Synopsis (so) NIO channels with IPv6 on Windows
Category java:classes_nio
Reported Against
Release Fixed
State 11-Closed, duplicate of 4640544, request for enhancement
Priority: 3-Medium
Related Bugs
Submit Date 18-FEB-2005
Description
FULL PRODUCT VERSION :
java version "1.5.0_01"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows XP
Professional
Version 2002
Service Pack 2

A DESCRIPTION OF THE PROBLEM :
Using IPv6 addresses in conjuction with NIO channels raises a "java.net.SocketException: Address family not supported by protocol
family".

Doing the same operation directly on a socket instance (i.e. without getting the socket from a channel) works.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Simply execute the piece of code below.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should run without exception (as it is the case for linux/solaris boxes on which it has been tested too).

Should display:
==> 1
==> 2
==> 3

ACTUAL -
==> 1
==> 2
java.net.SocketException: Address family not supported by protocol
family: bind
        at sun.nio.ch.Net.bind(Native Method)
        at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelI­mpl.java:119)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java­:59)
        at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java­:52)
        at external.ipv6.main(ipv6.java:31)

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Stacktrace is displayed by the application already.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.channels.ServerSocketChannel;


class ipv6 {
    static public void main(String[] notUsed) {
        try {
            byte[] addr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1};

            InetAddress inetAddr = InetAddress.getByAddress(addr);

            InetSocketAddress addr_8501 = new
InetSocketAddress(inetAddr, 8501);
            InetSocketAddress addr_8502 = new
InetSocketAddress(inetAddr, 8502);

            System.out.println("==> 1");

            ServerSocket serverSocket = new ServerSocket();
            serverSocket.bind(addr_8501); // This works

            System.out.println("==> 2");

            ServerSocketChannel channel = ServerSocketChannel.open();
            channel.socket().bind(addr_8502); //This does not work

            System.out.println("==> 3");
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
} 

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Unknown.
  xxxxx@xxxxx   2005-2-18 06:41:28 GMT
Work Around
N/A
Evaluation
We're working on IPv6 support in nio right now.  We expect it to be part of the
Mustang (jdk6.0) release.

  xxxxx@xxxxx   2005-2-18 15:21:30 GMT
Supporting IPv6 on Windows XP will involve some messy implementation changes. It is too risky to attempt this now for mustang so I will re-commit this RFE to dolphin. This also gives time to evaluate the updated IPv6 stack in Windows Vista.
Posted Date : 2005-10-28 10:15:31.0

--

9/22/06:
The IPv6 support in Windows XP is based on the Microsoft Research IPv6 implementation. It is separate to the IPv4 stack and does not support dual mode sockets. The classic networking implementation (java.net.Socket et. al.) was updated in J2SE 5.0 to use this IPv6 stack. It achieves this by creating two sockets (one IPv4 and one IPv6). That was a short term solution to provide some limited support for IPv6 on Windows. A new IPv6 stack arrives in Windows Vista. This stack is integrated and supports dual mode sockets. The plan is to update the NIO implementation in jdk7 to use dual mode sockets on Windows Vista when IPv6 is enabled.
Posted Date : 2006-09-22 13:50:44.0

This has been integrated into jdk7 build 36 via 4640544.
Posted Date : 2008-09-01 12:44:20.0
Comments
  
  Include a link with my name & email   

Submitted On 07-FEB-2006
cerasi
Please fix for Windows XP. Even JRE 6.0 is a workable solution if available in 2006. Your proposed resolution will force our customers to upgrade their systems to Windows Vista and probably their hardware. This is a serious blocking factor for our customers.


Submitted On 31-JUL-2006
cerasi
This bug still persists on Windows Vista Beta 2 Build 5384 and using JRE 1.6 Beta 2. Do you expect to fix nio support before JRE 1.6 RC.


Submitted On 18-JUN-2007
InetAddress ina= getByName("127.0.0.1");
			InetSocketAddress addr_8501 = new InetSocketAddress(ina, 8501);
            servidor = new ServerSocket();
            servidor.bind(addr_8501);
this is throwing a 
java.net.SocketException: Protocol family not supported
HELP ME!!


Submitted On 03-SEP-2007
Please, go ahead guys please, FIX IT ASAP please please.


Submitted On 26-NOV-2007
This is still not fixed in JDK7. Are there any plans to fix this at any time? This is a major problem to us and our customers.


Submitted On 28-APR-2008
alan.bateman
Support for new IPv6 stack in Windows Vista is included in the updates to NIO coming in the jdk7 (see http://openjdk.java.net/projects/nio).


Submitted On 09-MAR-2009
I see that JDK 7 has this problem fixed. Will this fix be backported to JDK 6?


Submitted On 22-MAY-2009
sheanchang
Why this bug is closed?  I am still seeing the problem with windows XP using jdk 6 and jdk7.


Submitted On 16-NOV-2009
Carlos_Pfitzner
this is working fine for me.

netstat -on
  TCP    189.106.77.133:8888    68.175.103.88:50717    TIME_WAIT       0
  TCP    189.106.77.133:8888    86.127.9.87:2904       TIME_WAIT       0
  TCP    189.106.77.133:8888    98.157.151.77:63824    TIME_WAIT       0
  TCP    189.106.77.133:8888    196.207.207.140:1565   TIME_WAIT       0
  TCP    189.106.77.133:8888    200.6.193.89:63315     TIME_WAIT       0
  TCP    [2001:470:7:ff::2]:8888  [2001:0:4137:9e50:34ac:1293:b80b:5cec]:49200
TIME_WAIT       0
  TCP    [2001:470:7:ff::2]:8888  [2001:41e0:ff16:0:224:81ff:fe36:25fc]:38391  T
IME_WAIT       0
  TCP    [2001:470:7:ff::2]:8888  [2001:41e0:ff16:0:224:81ff:fe36:25fc]:39273  T
IME_WAIT       0
  TCP    [2001:470:7:ff::2]:8888  [2001:41e0:ff16:0:224:81ff:fe36:25fc]:54150  T
IME_WAIT       0
  TCP    [2001:470:7:ff::2]:8888  [2001:41e0:ff16:0:224:81ff:fe36:25fc]:54238  T
IME_WAIT       0

C:\Program Files\Vuze>
C:\Program Files\Vuze>java  -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

C:\Program Files\Vuze>tracert ipv6.google.com

Tracing route to ipv6.l.google.com [2001:4860:b002::68]
over a maximum of 30 hops:

  1   206 ms   196 ms   177 ms  crobertp-2.tunnel.tserv13.ash1.ipv6.he.net [2001
:470:7:ff::1]
  2   201 ms   209 ms   194 ms  gige-g4-12.core1.ash1.he.net [2001:470:0:90::1]

  3   198 ms   191 ms   267 ms  pr61.iad07.net.google.com [2001:504:0:2:0:1:5169
:1]
  4     *        *        *     Request timed out.
  5     *        *        *     Request timed out.
  6   176 ms   176 ms   177 ms  qw-in-x68.1e100.net [2001:4860:b002::68]

Trace complete.
os: win xp sp3
thanks



PLEASE NOTE: JDK6 is formerly known as Project Mustang