rv1822
rv1822

Reputation: 169

How to use Telnet from Java

I need to telnet to a server, execute a few scripts, give inputs to those and receive output. Can I directly use Runtime.exec() and give the telnet command or do I need to learn about sockets? I understand that in the exec() method, I might need to do the input and output in 2 threads, is that right?

Thanks

Upvotes: 4

Views: 2792

Answers (1)

skaffman
skaffman

Reputation: 403441

Neither. Use Apache Commons Net, specifically the Telnet support part. No need to muck about with external processes, low-level socket handling or telnet command codes.

Upvotes: 7

Related Questions