commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Diogo Saad" <di...@ibnetwork.com.br>
Subject Net - TelnetClient with linux
Date Mon, 16 Aug 2004 19:06:32 GMT
Hi,

	I made a classe called TelnetService that uses TelnetClient.
One of the methods of this class is read() it's supposed to read all
available data from telnet inputstream and return it.
I've been using this method for some time in my machine (win2k server)
with no problems.
Now I tryed to use it into a linux machine and I got some problems!!
When I try to read() all available data from telnet inputstream it
returns a splited string ( not with all the content)...
Feels like it's an assyncronous client, because if I debug the system,
add a breakpoint and wait for some time, it reads the whole content.
But if i run my app without debug it does not return it completly...
feels like i'm trying to read the content before the server sends the
full response! 
The source for read() is bellow
Can you help me?


 public String read() {
       StringBuffer sb = new StringBuffer();
       try {
          char ch = (char) telnetInput.read();
          while (telnetInput.available() > 0) {               
              sb.append(ch);
              ch = (char) telnetInput.read();
          }           
          log.debug(sb.toString());
          return sb.toString();
       } catch (Exception e) {
           log.error(e);
       }
       return null;
   }


Diogo Saad
diogo@ibnetwork.com.br
Inter Business Tecnologia e Servicos


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message