Telnet Socket takes 40 sec to respond
843829Jul 19 2003 — edited Jul 28 2003I'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?