-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: yyC67448 Date: 06/24/98
The java.net.Socket.setSoLinger(boolean, int) truncates the linger value
to 2-byte integer on Win32 systems.
Here is the test demonstrating the bug:
---------------------------- test.java --------------------------------
import java.net.*;
class test
{
public static void main(String args[])
{
InetAddress sin = null;
Socket soc = null;
int linger = 65546;
int value = 0;
/*
* Try to get localhost address
*/
try {
sin = InetAddress.getLocalHost();
} catch(Exception e)
{
System.out.println("Can not get localhost Address:" + e);
System.exit(-1);
}
/*
* Hope Telnet service enabled on localhost
*/
try {
soc = new Socket(sin, 23, true);
} catch(Exception e)
{
System.out.println("Can not create socket:" + e);
System.exit(-1);
}
try {
soc.setSoLinger(true, linger);
value = soc.getSoLinger();
}
catch(Exception e)
{
try {
soc.close();
} catch(Exception e1)
{
System.out.println("Can not close socket :" + e1);
System.exit(-1);
}
System.out.println("Unexpected exception:" + e);
}
try {
soc.close();
} catch(Exception e1)
{
System.out.println("Can not close socket :" + e1);
System.exit(-1);
}
if( value != linger)
{
System.out.println("Failed. " + value + " != " + linger);
System.exit(-1);
}
System.out.println("OKAY");
}
}
---------------------- Output from the test -----------------
Failed. 10 != 65546
-----------------------------------------------------------------
======================================================================
- relates to
-
JDK-4170407 Regression test net\Socket\SetSoLinger.java failing with JDK1.2FCS-H
- Closed