Article View: borland.public.jbuilder.java.api
Article #74Slow socket connection in JDK1.5
From: 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
Technical Details
Message-ID:
<424c88a5@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 1089d0,a74a7bdd62bddbd3,start X-Google-Attributes: gid1089d0,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Aven" <aven_02@yahoo.com> Newsgroups: borland.public.jbuilder.java.api Subject: Slow socket connection in JDK1.5 Date: Thu, 31 Mar 2005 15:37:05 -0800 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 NNTP-Posting-Host: 128.111.68.241 Message-ID: <424c88a5@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112311973 128.111.68.241 (31 Mar 2005 15:32:53 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!newspeer.monmouth.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail