Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:55:38+00:00 2026-05-17T01:55:38+00:00

I work for a large organization that supports many different sites on a nation

  • 0

I work for a large organization that supports many different sites on a nation wide network. Our vendor supplies diagnostic tools for the hardware we use at each site. The diagnostics and reports are accessed via Telnet.

The problem is we want to monitor all sites simultaneously and currently we can only check them one at a time (via telnet).

I have already built something that will use Runtime.exec(String) to send ping commands to each IP address. But now I want to be able to send specific commands automatically using the vendor’s diagnostic and reporting tools. Any ideas on the best way to do this? NOTE we have a hybrid system – some of the sites are behind a firewall some are not. A complete solution would be ideal but I will settle for a partial one as well.

Could it be as simple as getting the input and output streams of the Process object returned by the Runtime.exec(String) and send my commands to the input and reading the response on the output? Or should I be connecting to port 23 (the usual telnet port) and then behave as any other client-server system. Or something else completely different?

I am continuing to try things out, just brainstorming at this point…

CODE: (sensitive information removed)

void exec(String ip)
{
  Socket sock = null;
  BufferedReader br = null;
  PrintWriter pw = null;

  try
  {
    sock = new Socket(ip, 23);

    br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
    pw = new PrintWriter(sock.getOutputStream());

    this.read(br);
    System.out.println("Sending username");
    pw.println("username");
    this.read(br);  // Always blocks here
    System.out.println("Sending password");
    pw.println("password");
    this.read(br);

    pw.close();
    br.close();
    sock.close();
  }
  catch(IOException e)
  {
    e.printStackTrace();
  }
}

void read(BufferedReader br) throws IOException
{
  char[] ca = new char[1024];
  int rc = br.read(ca);
  String s = new String(ca).trim();

  Arrays.fill(ca, (char)0);

  System.out.println("RC=" + rc + ":" + s);

//String s = br.readLine();
//      
//while(s != null)
//{
//  if(s.equalsIgnoreCase("username:"))
//    break;
//          
//  s = br.readLine();
//          
//  System.out.println(s);
//}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:55:39+00:00Added an answer on May 17, 2026 at 1:55 am

    Why don’t you simply use the Socket system ?

    Open a socket to the chosen server on port 23 and send your own commands from here.


    Here is a quick example :

    public class EchoClient {
        public static void main(String[] args) throws IOException {
    
            Socket pingSocket = null;
            PrintWriter out = null;
            BufferedReader in = null;
    
            try {
                pingSocket = new Socket("servername", 23);
                out = new PrintWriter(pingSocket.getOutputStream(), true);
                in = new BufferedReader(new InputStreamReader(pingSocket.getInputStream()));
            } catch (IOException e) {
                return;
            }
    
            out.println("ping");
            System.out.println(in.readLine());
            out.close();
            in.close();
            pingSocket.close();
        }
    }
    

    Resources :

    • oracle.com – All about sockets
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work on a large project in an organization that is (slowly) upgrading our
I work for a very large organization that is looking for new ideas. Currently
I work for an organization that is pretty much a start-up within a large
I am computational scientist that work with large amount of simulation data and often
I work in a group that does a large mix of research development and
I'm developing a web app that will access and work with large amounts of
I work for a fairly large government organization where about 60% of the users
Our developers frequently work in large Visual Studio projects and we often run command-line
I have a large work space which has many source files of C code.
Background I work for a large organization which has thousands of MS Access applications

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.