Is a telnet server actually running on the Unix machine? Most system administrators hate telnet because it's insecure, and therefore do not have it installed. They prefer SSH instead.
Also note that, at least as far as I know, telnet does not support file transfer. SSH does, through its SCP protocol.
What happens if you don't send the "cd //location//" command? Because then your example looks almost identical to the example on that page, except for the different waitfor symbol.
Archana Honnavalli
Ranch Hand
Joined: Feb 26, 2008
Posts: 39
posted
0
Tried with this.
Commented line 6 and line 8
Still getting null at line 7
Also eventually i need to access cd //location//
Because i need to access files in that directory.
Archana Honnavalli
Ranch Hand
Joined: Feb 26, 2008
Posts: 39
posted
0
One more doubt after parsing line 4
console prints lot of information like addpayload2 1, packet len, ssh info.
This i dont see when i login from telnet window
That is cmd prompt
Give command- telnet IP
Telnet window opens and prompts for uid and pwd.
After this no such information is shown.
What is this?
P.S: New to unix
Thanks
Archana
Eric Mission
Greenhorn
Joined: Apr 22, 2009
Posts: 22
posted
0
Archana, I've never used the SshWrapper class before so I can't comment on the error you are having but I am curious as to why you don't just use an SSH client. There are several freely available ones out there. I personally use PuTTy which has telnet, ssh and more.
I did some searching on this class and found a link to the SOURCE. I noticed that the class is using a basic socket to connect. As I mentioned before I'm not familiar with the API other than just reading the source but to me that generic socket connection may be your problem if it isn't taking permission into account. If the SshWrapper class does not account for permissions on the machine you are trying to access then that may explain why you are getting NULL when you send a command. In other words, the Unix machine may permit you to do a remote SSH connection but may forbid you from changing directories or running other commands.
I am guessing that you want to just issue a
or a
to the server and you can't even change directories (remote access permission block?).
My recommendations: 1) I would try to create my own custom socket server/client application that would read the files or even transfer them locally for reading 2) use an SSH client.
Hope that helps.
to infinity and beyond
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Access unix machine to read and save a file- from java code - Unix machine IP, userID, pwd given