| | |
how to execute telnet command in Java
![]() |
•
•
Join Date: Mar 2008
Posts: 4
Reputation:
Solved Threads: 0
Hi,
I want to check whether a system exists in LAN or not and also the database residing in that system is up or not.So, for this I'm trying to use telnet command as follows,
Runtime rt=Runtime.getRuntime();
Process p=rt.exec("telnet 192.168.1.15");
No error nothing ,It is executing .But by using the above command I don't know how to retrieve the success status .
Please,tell me a solution for this or is there any other way to solve this problem .
Thanks,
Sirisha.
I want to check whether a system exists in LAN or not and also the database residing in that system is up or not.So, for this I'm trying to use telnet command as follows,
Runtime rt=Runtime.getRuntime();
Process p=rt.exec("telnet 192.168.1.15");
No error nothing ,It is executing .But by using the above command I don't know how to retrieve the success status .
Please,tell me a solution for this or is there any other way to solve this problem .
Thanks,
Sirisha.
I think you will need to use the getInputStream() and getOutputStream() methods in the Process class to be able to do what you want to do. Basically you can use the I/O streams to communicate with the Process and then you can use the output from the Process to work out whether your command is successful. This might require a bit of trial and error, so I'll leave you to have a go at it.
There are no stupid questions, only those too stupid to ask for help.
echo is a web developer's best friend. ![]() |
Other Threads in the Java Forum
- Previous Thread: Expression Calculator
- Next Thread: MVC Architecture.
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card chat class client code collision component crashcourse css csv database eclipse ee error fractal free game gis givemetehcodez graphics gui html ide image input integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan loop machine map method methods migrate mobile netbeans newbie objects oriented output panel phone physics problem program programming project radio recursion reporting scanner se server service set sms socket software sort sql string swing test textfield threads transfer tree trolltech ubuntu utility windows





