Rebex



Sample: AnsiPlayer - GUI SSH Session Player

Replays saved SSH terminal sessions recorded using TerminalControl or VirtualTerminal components.

AnsiPlayer Screenshot

The core of this sample is the AnsiPlayerShellChannel class which implements the IShellChannel and IShellChannelFactory interfaces that interpret the recorded sessions and provide the saved communication to the TerminalControl object.

Check out the Recording communication tutorial and Windows Forms SSH client sample for information on recording your sessions.

This sample demonstrates:

  • Using the TerminalControl class.
  • Implementing a custom IShellChannel and IShellChannelFactory interfaces.
  • Binding the TerminalControl class to your own IShellChannelFactory interfaces.
  • Handling the Disconnected event.
  • Handling the RemoteResize event.
  • Resizing the terminal screen.

Sample files are included in the project.

C#

// open the input file for reading 
Stream inputStream = File.OpenRead("recorded_ANSI_file.ans");

// create a new AnsiPlayerShellChannel  
AnsiPlayerShellChannel player = new AnsiPlayerShellChannel(inputStream);

// bind created AnsiPlayerShellChannel to the TerminalControl object 
terminalControl.Bind(player);

VB.NET

' open the input file for reading 
Dim inputStream As Stream = File.OpenRead("recorded_ANSI_file.ans")

' create a new AnsiPlayerShellChannel  
Dim player As AnsiPlayerShellChannel = New AnsiPlayerShellChannel(inputStream)

' bind created AnsiPlayerShellChannel to the TerminalControl object 
terminalControl.Bind(player)

See also: