Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Running commands not returning results

$
0
0
I've created a SignalR SSH web console and I'm trying to run simple commands like "?" but I do not get a response, just an empty string. Here is a code sample:
            SshClient client;
            if (!SshClients.TryGetValue(connectionId, out client))
            {
                Clients.All.receive("ERROR: connection object not found");
                return;
            }

            if (!client.IsConnected)
                client.Connect();

            var sshCommand = client.CreateCommand(command);
            var asynch = sshCommand.BeginExecute();
            var reader = new StreamReader(sshCommand.OutputStream);

            while (!asynch.IsCompleted)
            {
                var result = reader.ReadToEnd();
                if (string.IsNullOrEmpty(result))
                    continue;
                Clients.All.receive(result);
            }
            sshCommand.EndExecute(asynch);

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>