JDK-6358574 : JCK6.0: getTTL() Default TTL value is not equal to 1
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows
  • CPU: x86
  • Submitted: 2005-12-02
  • Updated: 2012-03-23
  • Resolved: 2006-04-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Relates :  
Relates :  
Description
The following testcases fail on Windows Vista ONLY. Run was performed on AMD64 machine. The same testcases are passing on all other supported versions of windows:

api/java_net/MulticastSocket/MulticastSocket2011
api/java_net/MulticastSocket/MulticastSocket2004


with the following result:

MulticastSocket2011: Failed. Default TTL value is not equal to 1

MulticastSocket2004: Failed. Default TTL value is not equal to 1



To reproduce run the following code (port 50000 is hardcoded):

import java.net.*;
import java.io.*;

public class MulticastSocket2011 {
    public static void main (String[] args) {
        MulticastSocket soc=null;
        int port = 50000;
        int ttl;

        try {
            soc = new MulticastSocket(port);
        } catch (IOException e) {
            System.out.println("Can not create MulticastSocket instance:" + e);
            return;
        }

        try {
            ttl = soc.getTimeToLive();
        } catch (IOException e) {
            soc.close();
            System.out.println("Can not get TTL value:" + e);
            return;
        }

        soc.close();

        if (ttl == 1)
            System.out.println("OKAY");
        else
            System.out.println("Default TTL value is not equal to 1");
    }
}

Comments
EVALUATION With Vista Beta 2 (build 5308) the default value of ttl has been change back to 1 as it was in previous windows releases. No change necessary to test or jdk.
13-03-2006

EVALUATION Actually looking at the javadoc again the default ttl is described in the deprecated send(DatagramPacket,byte) method: Parameters: .... ttl - optional time to live for multicast packet. default ttl is 1. Update the implementation to set the default ttl to 1 when the socket is being created. We already do this for linux as some linux versions have a different ttl value.
08-03-2006

EVALUATION reassign to jck. This test should be removed or excluded from previous releases where applicable.
14-02-2006

EVALUATION I do not see where in the spec the default value of TTL in MulticastSocket is stated to be 1. It just happens to be 1 on most platforms and 128 on vista beta 1. If (in the test) you manually call setTimeToLive(1), then a subsequent call to getTimeToLive() will return 1. I do not think this is a bug, and the test is not correct to test the default value of TTL by calling getTimeToLive without first setting it. I will contact the submitter to clarify this before closing.
13-02-2006