Subscribe to DataReceived Event of ShellStream

Mar 26, 2014 at 11:03 AM
Hello folks,
I would like to implement a service where I´m able to parse the results of the Linux command top.
So every second my server returns a new result of the performance stats.

I already tried the following:
public void CreateShellStream(int hashCode, string command, string idetifier)
            var con = GetConnection(hashCode);
            IConnectionPart part = new ConnectionPart();
            part.Shell = con.Connection.CreateShellStream(idetifier, 0, 0, 0, 0, 1024);            
            part.Shell.DataReceived += Shell_DataReceived;

        void Shell_DataReceived(object sender, ShellDataEventArgs e)
            var str = System.Text.Encoding.Default.GetString(e.Data);
            int i = 0;
The problem is that I only receive in the subscribed event the command I passed to the Shell, but I get no result of the server.

Is there an other way to reach this?