if it is possible by telnet can you let me know how to do it using java
Thanks in advance
Main Topics
Browse All TopicsAll Experts
using java i want to automate telnet to connect fom window NT to UNIX and use the CKSUM command in the unix machine and bring the output to windows machine. Is it possible in java and if possible can some experts just send me the sample scripts for that
Thanks in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
Telnet is not safe, because the data that is being transferred is not encrypted, you're better off using ssh:
http://www.cs.hut.fi/ssh/
and don't forget to read this:
http://librenix.com/?nexta
Hope that helps :-)
Regards,
Warturtle
I dont have provision to buy a software and install it in my computer that is why I am asking how to do it in telnet
I am not using telnet to transfer data. I just want to execute CKSUM command in the remote UNIX system and bring the output to windows system
let me know if there is any way I can do it
Thanks
You can develop a telnet client in java..and execute your CKSUM sommand also...
There are various telnet client samples mostly you will found in C++, but you can convert that easly for java..
You need RFC 0854 to understand how telnet client and server communicate, so , using client sockets in java you can create your own customized telnet client which will only execute CKSUM command.
For telnet client samples and RFC:
www.codearchive.com/rate.p
RFC:
http://www.faqs.org/rfcs/r
They do have some example code in the Javadoc at:
http://javassh.org/downloa
but I think you had better be prepared for some frustration: I think it is easy to cause this program to hang, depending on the behavior of the remote host.
Hi,
You can download the Java Telnet Client on your machine and run it by using standard JDK. Here is the URL:
http://sourceforge.net/pro
Hope that helps,
Regards,
Warturtle
For the record, the JTA 2.5 that are available from the SourceForce web site and from javassh.org are the same code base.
And just to provide you with a complete example (where the target host name is a command line argument)
import de.mud.telnet.TelnetWrappe
public class mytest {
static public void main(String args[]){
TelnetWrapper telnet = new TelnetWrapper();
try {
telnet.connect(args[0], 23);
telnet.login("amorrow", "mypass");
telnet.setPrompt("user@hos
telnet.waitfor("Terminal type?");
telnet.send("dumb");
System.out.println(telnet.
} catch(java.io.IOException e) {
e.printStackTrace();
}
}
}
I have not got this working yet, but it is close. Again, you will have to examine this tool to see how it tries to answers questions like "what does the login prompt look like?".
Also, I recommend that you use Ethereal ( http://www.ethereal.com ) if you . It will display some of the telnet protocol that occurs. You can compare the log of a successful telnet session (with any standard telnet client) and this software to see where it gets hung up. This protocol tries to send stuff like what kinds of tty you have. Also, I recommend that you set up the login account with no .cshrc or .profile files to avoid any extra output or things like a UNIX stty command that might mess you up.
One more follow-up. I have not yet gotten the current version of JTA to work, but I did get jta25b to work for me. What I found was that you have to know also know what they command prompt will be so that JTA can recognize when output has gone back to a wait state. There is a version of jta25b at
http://www.netadmintools.c
and here is my current version of that program. I left the host, "linux-int" to be a command line argument, but note how my prompt is specfic to that machine.
import de.mud.telnet.TelnetWrappe
public class mytest {
static public void main(String args[]){
TelnetWrapper telnet = new TelnetWrapper();
try {
telnet.connect(args[0], 23);
telnet.login("amorrow", "mypass");
telnet.setPrompt("[amorrow
System.out.println(telnet.
} catch(java.io.IOException e) {
e.printStackTrace();
}
}
}
One other note: I noticed that JTA is hardcoded to expect the login prompts to be "login:" and "Password:". This is true for almost all relevant versions
of UNIX and Linux.
One last follow-up: These guys also have the domain name javatelnet.org, so you ca use
http://javatelnet.org/down
Their current wrapper is broken and I have contacted them about it. Definitely use the older version from
http://www.netadmintools.c
Business Accounts
Answer for Membership
by: amorrow5Posted on 2004-05-18 at 12:00:36ID: 11101228
Let me comment that Telnet is not a very good approach to achieve remote command execution because you have to script the behavior, especially what does the login prompt looks like.
cles/ scrip ting_telne t_sessions _using_jav a.html
d/source/i ndex.html , de.mud.telnet.ScriptHandle r)
Here is a product that does this:
http://www.jscape.com/arti
Here is an open-source solution that offers similar functionality
http://javassh.org/
(See http://javassh.org/downloa
More robust solutions would be to use rexec, rsh, or, better still, ssh since you will not be dependent on what the login prompt looks like.