Hey,

Very new to java socket programming and I am having an issue with automating a 
session to issue one command and then exit. When I use the commons telnet 
library I am able to connect and successfully run the command, but only when I 
interact with the prompt. When I try and simulate just issuing the commands it 
does not work. What seems to be happening is that instead of writing each 
command as a separate packet, all the commands are being sent in the same 
packet (validated this with wireshark).

What I have checked.


1.       The batch file does work locally on the system.

2.       The command does work when typed into a telnet session (validated with 
tcpview).

3.       The non-working version does connect to the remote system.

4.       The correct auth information is being passed to the function call.

Setup that works:


Just like the weather demo

My faulty setup:

Append the user, pass, command and exit strings with "\r\n". (user += "\r\n";)
And with each item I:
                Convert them into a ByteArrayInputStream (in = new 
ByteArrayInputStream(user.getBytes());)
                Invoke Util.copyStream (Util.copyStream(in, remoteOutput); ) // 
where remoteOutput is the telnet's outputstream

Thanks

Jason Dorsey | Engineering Intern

Reply via email to