Author Topic: Remote Console Monitoring  (Read 632 times)

Hey

I'm working on a complete control panel type thing (similar to the one that Zack0Wack0 has) and I need to figure out how to monitor the torque console (note: I'm willing to use something other than TS if necessary).

I've tried packaging echo() and redirecting stdio but neither worked, and console.log cannot be accessed while Blockland is running.

I know this can be done - Kalphiter for one has managed - and if anyone has ideas, please share :)

Tried accessing the console.log file from within blockland thru FileObject - no luck :/

Tried accessing the console.log file from within blockland thru FileObject - no luck :/

Because Blockland keeps it open, so you can't read what is still being written.

You can't.

I use an outside program written in Java to read the output of Blockland.

You can't.

I use an outside program written in Java to read the output of Blockland.
(note: I'm willing to use something other than TS if necessary).

I've tried redirecting stdio but [it didn't] work
I know java - any chance you could post the code or just give me a push in the right direction?

Code: [Select]
    public void run()
    {
String consoleLine = null;
    try
{
    String lastTwoChars = "";
    String lastChar_0 = "";
    String lastChar_1 = "";

    Runtime rt = Runtime.getRuntime();

    proc = rt.exec(cmd);
    proc_in = proc.getInputStream();
    proc_out = proc.getOutputStream();
    proc_err = proc.getErrorStream();
    BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
    output = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
    String currentChar;
    int lineInt;
    while ((lineInt = input.read()) >= 0 && lineInt < 256)
    {
currentChar = new String(new byte[] { new Integer(lineInt).byteValue() });
lastChar_0 = lastChar_1;
lastChar_1 = currentChar;
lastTwoChars = lastChar_0 + lastChar_1;

if(lineInt == 10)
{
    addConsole(consoleLine);
    consoleLine = "";
}
else if(lineInt != 13)
    consoleLine += currentChar;
    }
    running = false;
}
catch(Exception g)
{
    addConsole("Exception: "+ g);
    running = false;
}
running = false;
onStop();
    }
Of course, there are many methods that aren't there, and I was just having fun with reading character by character

Great, thanks.

EDIT: Tried it out with the required modifications - it works beautifully. I didn't think this kind of thing would work (what with the custom console), but hey!
« Last Edit: July 11, 2011, 07:07:33 PM by cucumberdude »