Thread View: borland.public.jbuilder.java.api
1 messages
1 total messages
Started by Aven
Thu, 31 Mar 2005 23:37
Slow socket connection in JDK1.5
Author: Aven
Date: Thu, 31 Mar 2005 23:37
Date: Thu, 31 Mar 2005 23:37
29 lines
1726 bytes
1726 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads