On 8 September 2014 16:52, Anjib Mulepati <[email protected]> wrote: > Hi All, > > > > I am using this AutomatedTelnetClient > (http://stackoverflow.com/questions/1195809/looking-for-java-telnet-emulator) > to send sequence of command to telehack.com:23. > AutomatedTelnetClient telnet = new AutomatedTelnetClient("telehack.com", > "23"); > telnet.sendCommand("rand ");//run OK > telnet.sendCommand("cal "); //run OK > telnet.sendCommand("date "); //never run > > > first two command run OK and gives me > output but third one never runs. I change the order of cal and > date this time rans and date execute but not cal. So it running > first two commands only.
Could try adding a dummy command at the end as a temporary work-round. But that should not be necessary. > > > So my question is do I have to use some kind of thread in that > program to do read and write operation from the telnet server? > That should not be necessary - TelnetClient is intended for use from a single thread. See the sample code here: http://commons.apache.org/proper/commons-net/examples/telnet/TelnetClientExample.java However, there have been some fixes which have not yet been released, including one which relates to EOL handling. That could perhaps cause the problems you are seeing. So it might be worth trying the current code from SVN. There's a more recent version of the example as well. > > Thanks, > > Anjib --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
