-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
6
-
generic
-
windows_xp
java.net.MulticastSocket.send() reports 'socket closed' (WinXP)
see a test (it is similar to test from CR 6425815)
-------------------
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);
if( ms.isClosed() )
out.println( "!!! error: created and bounded socket is closed after setTimeToLive() !!!" );
byte data[] = { 0, 1, 2 };
DatagramPacket dp = new DatagramPacket(data, data.length,
InetAddress.getByName("224.80.80.80"), 1111 );
ms.send( dp );
} 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/169.254.25.129 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.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth0'(Microsoft Loopback Adapter)
MTU = 1500, loopback = false, pointToPoint = false, up = false, virtual = false, suppMulticast = true
addresses: /169.254.25.129
/fe80:0:0:0:0:4cff:fe4f:4f50%4
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth1'(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.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth2'(Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter, Copper RJ-45 - Packet Scheduler Miniport)
MTU = 1500, loopback = false, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses:
'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%7
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'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
-------------------
see a test (it is similar to test from CR 6425815)
-------------------
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);
if( ms.isClosed() )
out.println( "!!! error: created and bounded socket is closed after setTimeToLive() !!!" );
byte data[] = { 0, 1, 2 };
DatagramPacket dp = new DatagramPacket(data, data.length,
InetAddress.getByName("224.80.80.80"), 1111 );
ms.send( dp );
} 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/169.254.25.129 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.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth0'(Microsoft Loopback Adapter)
MTU = 1500, loopback = false, pointToPoint = false, up = false, virtual = false, suppMulticast = true
addresses: /169.254.25.129
/fe80:0:0:0:0:4cff:fe4f:4f50%4
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth1'(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.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'eth2'(Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Adapter, Copper RJ-45 - Packet Scheduler Miniport)
MTU = 1500, loopback = false, pointToPoint = false, up = true, virtual = false, suppMulticast = true
addresses:
'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%7
java.net.SocketException: Socket closed
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:612)
at test8.processList(test8.java:38)
at test8.main(test8.java:61)
'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-6425815 java.net.MulticastSocket.setTimeToLive(255) reports 'Socket closed' (WinXP, IPv6)
-
- Resolved
-