Renci.SshNet.ShellStream.Flush C# (CSharp) Method

Flush() public method

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
An I/O error occurs.
public Flush ( ) : void
return void
        public override void Flush()
        {
            if (_channel == null)
            {
                throw new ObjectDisposedException("ShellStream");
            }
            _channel.SendData(_outgoing.ToArray());
            _outgoing.Clear();
        }

Usage Example

Exemplo n.º 1
-2
        static void Main(string[] args)
        {
            client = new SshClient("130.18.14.67", "", "");
            client.Connect();
            stream = client.CreateShellStream(@"xterm", 80, 24, 800, 600, 2048);
            string cmd = "";

            //flush buffer
           stream.Flush();
           while(true)
           {
               stream.DataReceived += StartAsyncRead;
               Console.WriteLine("Logged in success!: ");
               cmd = Console.ReadLine();
               stream.WriteLine(cmd);
           }

           
        }