aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Telnet client from webapp [was: Help needed in jsp and beans] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Telnet client from webapp [was: Help needed in jsp and beans]" Watch "Telnet client from webapp [was: Help needed in jsp and beans]" New topic
Author

Telnet client from webapp [was: Help needed in jsp and beans]

Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
I have a jsp page with some form fields....When user clicks the submit button, i must take some input and based on whichi must execute a shell script on another server... I use a bean to process the data from the jsp page and run a script on another server

The question is
1. How do i connect to that server (IP,Login and password info available) and execute that script ( I would normally do so using Telnet).

Please help me with this as I m new to jsp

Thanks a lot to all the people in advance

[BPSouther: Removed URGENT from subject line.]

[ March 26, 2008: Message edited by: Ben Souther ]
[ March 26, 2008: Message edited by: Ben Souther ]
Syed Saifuddin
Ranch Hand

Joined: Sep 01, 2003
Posts: 130
Hi Govind SrinivasaRaghavan

Try to find some info in System.getProperty();


Thank You & Best Regards,

Syed Saifuddin,
Senior Software Engineer

SAP Oracle AIX & Java Training
http://www.socialinet.com
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Syed Saifuddin:
Try to find some info in System.getProperty();


What good would this do?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Thank you very much Mr Ben...but i m still confused about how actually it can be used to solve my problem... will i able to execute scripts in a remote machine with its help

(sorry if you think the question is stupid i m still trying to learn).

Thanks a lot in advance
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Does the other server have a webserver or application server on it?
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
No...The scripts that I want to execute on this server are otherwise executed through telnet
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Writing a telnet client in Java (Servlet or JSP) is going to be tricky at best. One library that will help out a bit is the commons/net library.
Which has some telnet capabilities.
http://commons.apache.org/net/

Even with that, I can't picture it being easy to implement this in a solid fashion. Is there any reason that these scripts can't be wrapped as CGI calls with Apache or another web server?
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
thank you. Well the specification that one of our clients have actually given us requires me to do that way( Since that server doesn't have any web/application server).
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Mr Ben i am really sorry to be troubling you again, could you also tell me if i could keep getting the result of execution of such scripts from the server side and send it back to the client???
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't have any experience with writing telent clients from Java.
I assume that you can.

I'm going to change the title of this and move it to our Sockets and InternetProtocols forum since it's got more to do with networking and writing clients than with JSP.
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Thanks for the help Ben.... I hope that people in this forum can help me out with the problem that i am facing
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I would start by going through the documentation provided by the commons/net libarary. You might be able to find the answer faster by yourself.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42639
    
  65
What problem is that? Ben pointed you to a Telnet client implementation - it comes with an example program that uses it. If you've used Telnet successfully so far, that should enable you to do that programmatically as well.


Ping & DNS - my free Android networking tools app
Hari Srinivas
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
Well thanks a lot everyone....i was able to do that...thank you Ben and Ulf for your suggestions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Telnet client from webapp [was: Help needed in jsp and beans]