Slow socket connection in JDK1.5


2005-04-01 07:37:05 AM
jbuilder13
Hi,
It seems that socket connection is much slower in JDK1.5 than that in
JDK1.4.
The test code is as follows. I connect to a distant telnet host.
----------------
import java.net.*;
import java.io.*;
public class Test2 {
public static void main(String[] args) throws Exception {
System.out.println("begin...");
Socket sock = new Socket(args[0], Integer.parseInt(args[1]));
InputStream in = sock.getInputStream();
OutputStream out = sock.getOutputStream();
while(true) {
System.out.print((char)in.read());
}
}
}
----------------
When I compile and run it using JDK1.4, the cursor blinks 1~2 times before
connected.
When I compile and run it using JDK1.5, the cursor blinks 5+ times before
connected.
Is there any way I can fix the problem?
Thanks.
Aven