JDK-6416739 : MulticastSocket cannot be created with an InetSocketAddress constructed by an IPv6 address
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_9
  • CPU: sparc
  • Submitted: 2006-04-22
  • Updated: 2011-03-17
  • Resolved: 2006-04-24
Related Reports
Duplicate :  
java.net.BindException is thrown when a MulticastSocket is constructed with MulticastSocket(InetSocketAddress address) if the address is derived from an IPv6 address.

See the following program and output:

import java.net.*;

public class Test2 {
    public static void main(String[] argv) throws Exception {
        InetAddress localHost = InetAddress.getByName(argv[0]);
        InetSocketAddress addr = new InetSocketAddress(localHost, 0);
        MulticastSocket ms = new MulticastSocket(addr);

/usr/java/jdk1.5.0/bin/java Test2 fe80:0:0:0:207:e9ff:fe62:7e18
Exception in thread "main" java.net.BindException: Cannot assign requested address
	at java.net.PlainDatagramSocketImpl.bind0(Native Method)
	at java.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:82)
	at java.net.DatagramSocket.bind(DatagramSocket.java:368)
	at java.net.MulticastSocket.<init>(MulticastSocket.java:147)
	at Test2.main(Test2.java:7)

uname -a
Linux d-usca22-163-163 2.6.4-52-smp #1 SMP Wed Apr 7 02:11:20 UTC 2004 i686 i686 i386 GNU/Linux

eth0      Link encap:Ethernet  HWaddr 00:07:E9:62:7E:18  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::207:e9ff:fe62:7e18/64 Scope:Link
          RX packets:532432 errors:0 dropped:0 overruns:0 frame:0
          TX packets:361266 errors:0 dropped:0 overruns:0 carrier:0
          collisions:94403 txqueuelen:1000 
          RX bytes:240731598 (229.5 Mb)  TX bytes:35615686 (33.9 Mb)
          Base address:0xcc00 Memory:ff8e0000-ff900000 

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:65139 errors:0 dropped:0 overruns:0 frame:0
          TX packets:65139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:28721436 (27.3 Mb)  TX bytes:28721436 (27.3 Mb)

This problem is reproducible on SuSE Linux, but not on Solaris.

EVALUATION It has been fixed in mustang b33 as CR 6206527.