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 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.

We have develop a telnet client and remote server we are facing a problem with telnet command how to execute telnet comand in windows....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.