Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Telnet Socket takes 40 sec to respond

843829Jul 19 2003 — edited Jul 28 2003
I'm using a socket to make a telnet connection. After sending the command, it takes 40 seconds to get a response. If I manually open a telnet connection, the response is very quick. Here's a piece of the code:

out = new PrintWriter(mySocket.getOutputStream(), true);
in = new BufferedReader (new InputStreamReader(mySocket.getInputStream()));
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
//userInput is a String

while ((userInput = stdIn.readLine()) != "q") {
out.println(userInput);
System.out.println("echo: " + in.readLine()); <---This line takes 40 seconds
System.out.println("done");
}

If I type "touch blah.txt" and break the program, I can manually telnet in the system and see the blah.txt. But it takes 40 seconds for the program to tell me "done".

Any command after this 40 seconds has a reasonable response time. Any suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 25 2003
Added on Jul 19 2003
6 comments
244 views