-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b86
-
generic
-
windows_xp
java.net.MulticastSocket.setTimeToLive(255) reports 'Socket closed' (WinXP, IPv6)
Before call setTimeToLive() I check the isClosed() flag and it's value is false.
After that setTimeToLive() throws exception 'Socket closed'.
see the test:
---------------
import java.net.*;
import java.io.*;
import java.util.*;
public class test8 {
static PrintStream out = System.out;
static void processList( Enumeration<NetworkInterface> list, String s ){
while( list.hasMoreElements() ){
NetworkInterface ni = list.nextElement();
// print NetworkInterface info
out.println( String.format( "\n%s'%s'(%s)", s, ni.getName(), ni.getDisplayName() ) );
try {
// print NetworkInterface info
out.println(
String.format(
"%s MTU = %d, loopback = %s, pointToPoint = %s, up = %s, virtual = %s, suppMulticast = %s",
s, ni.getMTU(),
ni.isLoopback(), ni.isPointToPoint(), ni.isUp(), ni.isVirtual(), ni.supportsMulticast() ) );
if(ni.supportsMulticast()){
Enumeration<InetAddress> ias = ni.getInetAddresses();
out.print("addresses:");
while( ias.hasMoreElements() ){
InetAddress ia = ias.nextElement();
out.println( "\t" + ia );
MulticastSocket ms = new MulticastSocket( new InetSocketAddress(ia, 1234) );
try {
if( ms.isClosed() )
out.println( "!!! error: created and bounded socket is closed !!!" );
ms.setTimeToLive(255);
} finally {
ms.close();
}
}
}
processList( ni.getSubInterfaces(), s + " " );
} catch( IOException x ){
x.printStackTrace( out );
}
}
}
public static void main( String[] args ){
try {
InetAddress lh = InetAddress.getLocalHost();
out.print( String.format( "local host is '%s':", lh.getHostName() ) );
InetAddress[] addrs = InetAddress.getAllByName(lh.getHostName());
for( InetAddress a : addrs )
out.print( " " + a );
out.println("");
Enumeration<NetworkInterface> list = NetworkInterface.getNetworkInterfaces();
processList( list, "" );
} catch( Exception x ){
x.printStackTrace( out );
}
}
}
---------------
result:
---------------
Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test8
local host is 'zv': zv/129.159.125.21 zv/0:0:0:0:0:0:0:1
'lo'(MS TCP Loopback interface)
MTU = 1500, loopback = true, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses: /127.0.0.1
/0:0:0:0:0:0:0:1
/fe80:0:0:0:0:0:0:1%1
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'eth0'(3Com EtherLink XL 10/100 PCI For Complete PC Management NIC (3C905C-TX) - Packet Scheduler Miniport)
MTU = 1500, loopback = false, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses: /129.159.125.21
/fe80:0:0:0:20a:5eff:fe54:4bc8%5
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'tun0'(Teredo Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = false, virtual = false, suppMulticast = true
addresses: /fe80:0:0:0:0:5445:5245:444f%4
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'tun1'(6to4 Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = true, virtual = false, suppMulticast = false
'tun2'(Automatic Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = true, virtual = false, suppMulticast = false
---------------
Before call setTimeToLive() I check the isClosed() flag and it's value is false.
After that setTimeToLive() throws exception 'Socket closed'.
see the test:
---------------
import java.net.*;
import java.io.*;
import java.util.*;
public class test8 {
static PrintStream out = System.out;
static void processList( Enumeration<NetworkInterface> list, String s ){
while( list.hasMoreElements() ){
NetworkInterface ni = list.nextElement();
// print NetworkInterface info
out.println( String.format( "\n%s'%s'(%s)", s, ni.getName(), ni.getDisplayName() ) );
try {
// print NetworkInterface info
out.println(
String.format(
"%s MTU = %d, loopback = %s, pointToPoint = %s, up = %s, virtual = %s, suppMulticast = %s",
s, ni.getMTU(),
ni.isLoopback(), ni.isPointToPoint(), ni.isUp(), ni.isVirtual(), ni.supportsMulticast() ) );
if(ni.supportsMulticast()){
Enumeration<InetAddress> ias = ni.getInetAddresses();
out.print("addresses:");
while( ias.hasMoreElements() ){
InetAddress ia = ias.nextElement();
out.println( "\t" + ia );
MulticastSocket ms = new MulticastSocket( new InetSocketAddress(ia, 1234) );
try {
if( ms.isClosed() )
out.println( "!!! error: created and bounded socket is closed !!!" );
ms.setTimeToLive(255);
} finally {
ms.close();
}
}
}
processList( ni.getSubInterfaces(), s + " " );
} catch( IOException x ){
x.printStackTrace( out );
}
}
}
public static void main( String[] args ){
try {
InetAddress lh = InetAddress.getLocalHost();
out.print( String.format( "local host is '%s':", lh.getHostName() ) );
InetAddress[] addrs = InetAddress.getAllByName(lh.getHostName());
for( InetAddress a : addrs )
out.print( " " + a );
out.println("");
Enumeration<NetworkInterface> list = NetworkInterface.getNetworkInterfaces();
processList( list, "" );
} catch( Exception x ){
x.printStackTrace( out );
}
}
}
---------------
result:
---------------
Z:\tests>z:/lnks/jdk6/bin/java.exe -cp . test8
local host is 'zv': zv/129.159.125.21 zv/0:0:0:0:0:0:0:1
'lo'(MS TCP Loopback interface)
MTU = 1500, loopback = true, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses: /127.0.0.1
/0:0:0:0:0:0:0:1
/fe80:0:0:0:0:0:0:1%1
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'eth0'(3Com EtherLink XL 10/100 PCI For Complete PC Management NIC (3C905C-TX) - Packet Scheduler Miniport)
MTU = 1500, loopback = false, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses: /129.159.125.21
/fe80:0:0:0:20a:5eff:fe54:4bc8%5
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'tun0'(Teredo Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = false, virtual = false, suppMulticast = true
addresses: /fe80:0:0:0:0:5445:5245:444f%4
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.setTimeToLive(Native Method)
at java.net.MulticastSocket.setTimeToLive(MulticastSocket.java:209)
at test8.processList(test8.java:32)
at test8.main(test8.java:55)
'tun1'(6to4 Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = true, virtual = false, suppMulticast = false
'tun2'(Automatic Tunneling Pseudo-Interface)
MTU = 1280, loopback = false, pointToPoint = true, up = true, virtual = false, suppMulticast = false
---------------
- relates to
-
JDK-6434482 java.net.MulticastSocket.send() reports 'socket closed' (WinXP)
-
- Closed
-