Click here to Skip to main content
13,252,815 members (50,194 online)
Click here to Skip to main content
Add your own
alternative version


70 bookmarked
Posted 6 Oct 2007

Terminal Control Library (C# VT100/ANSI/XTERM SSH Telnet)

, 2 Jan 2009
Rate this:
Please Sign up or sign in to vote.
This is based on Poderosa Project


My original project can be found here.

I've been trying for a while to come up with a .NET control that would handle VT100/ANSI formatting and connect to SSH2 servers.

I've been through the commercial ones and still haven't found one that suited me.

My last project was based on Granados SSH library (open source SSH .NET implementation) and AckTerm (open source partially completed VT100 control).


This library is an attempt at creating a library based on the "Poderosa" project which can be found here.

Poderosa IMO is the best terminal emulator. It's open source, and is better than the commercial clients. Go check it out for yourself, it's worth it. You can find the original Poderosa CSV source there.

I tried for a couple of weeks to encapsulate components of Poderosa, but the code comments are all in Japanese and I couldn't find any good docs that described the source code. The developer community for Poderosa also appears to be all Japanese, so I felt pretty much on my own.

Using the Code

What I pretty much did here was encapsulate the entire Poderosa application into a library. Then I exposed certain elements so an application developer can simply drop the "Terminal Control.dll" into his/her app and have a control that acts like you would expect any .NET control to act.

This code was written using Visual Studio .NET 2005 Professional and requires .NET Framework 2.0.

Points of Interest

The Poderosa solution is made up of 5 projects:

  1. Container - This is the actual Poderosa application
  2. Terminal - A library providing Telnet capabilities as well as the Terminal Emulation
  3. Common - Code that is shared between the Poderosa application and the Port Forwarding Tool
  4. Granados - SSH library that supports just about every feature of SSH
  5. Portforwarding - A standalone application (uses Terminal, Common, and Granados libraries) that provides SSH portforwarding functionality

First Step

What I've done with my library, was to change "Container" into a Library output, and implement a public class based on System.Windows.Forms.Control.

Second Step

The first time my class ("WalburySoftware.TerminalControl") is instanced, it runs Poderosa code:

GApp.Run(args); GApp._frame._multiPaneControl.InitUI(null, GApp.Options);
GEnv.InterThreadUIService.MainFrameHandle = GApp._frame.Handle; 

Poderosa has lots and lots and lots of static variables. Until I can get the time and motivation to go through them and make the appropriate changes, these variables will need to be initialized before you can use any of Poderosa's classes.

Third Step

If you look at the method Poderosa.ConnectionCommandTarget.Resize, you'll see the line:

	return CommandResult.Denied 

This throws an exception. I took it out because it doesn't do anything for my library. I'm not sure what the ModalTerminalTask variable is used for. If you include that line, the terminal will not resize properly.

Final Step

Now we are free to create and use TerminalPanes as we need.

You'll see the steps in WalburySoftware.TerminalControl.Connect() that connect the TerminalPane to an SSH2 connection.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionSometimes Keyexchange error Pin
Win32nipuh30-Sep-17 21:42
memberWin32nipuh30-Sep-17 21:42 
QuestionAbout Midnight commander Pin
Win32nipuh30-Sep-17 3:55
memberWin32nipuh30-Sep-17 3:55 
QuestionVery Nice Pin
khalid kalyar9-Aug-16 22:22
memberkhalid kalyar9-Aug-16 22:22 
QuestionDivide(/) key and NumLock key issue - not able to send the correct keycodes Pin
Priyanka Lalchandani20-May-16 0:37
memberPriyanka Lalchandani20-May-16 0:37 
QuestionVI doesn't seem to work Pin
denson3-May-16 9:41
memberdenson3-May-16 9:41 
Question!!! !!! Pin
Member 1147611928-Feb-15 9:33
memberMember 1147611928-Feb-15 9:33 
QuestionHas anyone tried to implement this to serial port? Pin
ElectroMonster18-Dec-14 12:47
memberElectroMonster18-Dec-14 12:47 
QuestionMy vote of 5 Pin
Member 409630916-Dec-14 0:36
memberMember 409630916-Dec-14 0:36 
QuestionHTOP Fails? Pin
Taylor 1123666316-Nov-14 11:37
memberTaylor 1123666316-Nov-14 11:37 
QuestionQuestions: cant paste & errors Pin
sandaasu27-Jul-14 3:32
membersandaasu27-Jul-14 3:32 
AnswerRe: Questions: cant paste & errors Pin
Prashant. B. Chavan3-Aug-14 1:20
memberPrashant. B. Chavan3-Aug-14 1:20 
GeneralRe: Questions: cant paste & errors Pin
sandaasu11-Aug-14 1:50
membersandaasu11-Aug-14 1:50 
SuggestionRe: Questions: cant paste & errors Pin
Prashant. B. Chavan16-Aug-14 1:22
memberPrashant. B. Chavan16-Aug-14 1:22 
GeneralRe: Questions: cant paste & errors Pin
sandaasu11-Aug-14 9:30
membersandaasu11-Aug-14 9:30 
GeneralRe: Questions: cant paste & errors Pin
Prashant. B. Chavan16-Aug-14 1:39
memberPrashant. B. Chavan16-Aug-14 1:39 
GeneralRe: Questions: cant paste & errors Pin
sandaasu6-Oct-14 10:38
membersandaasu6-Oct-14 10:38 
GeneralRe: Questions: cant paste & errors Pin
Prashant. B. Chavan8-Oct-14 10:54
memberPrashant. B. Chavan8-Oct-14 10:54 
Questionproblem in getting text from terminalemulator Pin
maulik2915-Jul-14 20:25
membermaulik2915-Jul-14 20:25 
QuestionSSH PORT Pin
cavalin xucro29-Mar-14 8:31
membercavalin xucro29-Mar-14 8:31 
AnswerRe: SSH PORT Pin
Prashant. B. Chavan12-Apr-14 0:00
memberPrashant. B. Chavan12-Apr-14 0:00 
SuggestionSending an ArrowKey Press Pin
John Mansell28-Dec-13 8:38
memberJohn Mansell28-Dec-13 8:38 
QuestionThis application in Application) Pin
wskumar3-Dec-13 5:10
memberwskumar3-Dec-13 5:10 
AnswerRe: This application in Application) Pin
Prashant. B. Chavan3-Aug-14 0:58
memberPrashant. B. Chavan3-Aug-14 0:58 
Questionvi editor in Telnet mode Pin
lucaal14-Oct-13 21:58
memberlucaal14-Oct-13 21:58 
GeneralAWESOME! Pin
cavalin xucro18-Aug-13 11:00
membercavalin xucro18-Aug-13 11:00 
GeneralMy vote of 5 Pin
Member 1002960720-Jun-13 2:06
memberMember 1002960720-Jun-13 2:06 
Questionread from terminal Data(TerminalPane.ConnectionTag.Document.LastLineNumber using) Pin
Member 86027667-Jun-13 7:19
memberMember 86027667-Jun-13 7:19 
QuestionHow to refresh the data in the terminal control screen? Pin
JerryFinuliar5-May-13 21:13
memberJerryFinuliar5-May-13 21:13 
Questionhow to copy informations from terminal. Pin
dainu3-May-13 23:21
memberdainu3-May-13 23:21 
AnswerRe: how to copy informations from terminal. Pin
Columbus-MCSD4-May-13 4:27
memberColumbus-MCSD4-May-13 4:27 
GeneralRe: how to copy informations from terminal. Pin
dainu4-May-13 4:40
memberdainu4-May-13 4:40 
Questioncan you give me example for serial connect,,, Pin
tanjiejun19823-Feb-13 23:11
membertanjiejun19823-Feb-13 23:11 
QuestionGetting Exception Pin
SyedWaqas29510-Dec-12 0:17
memberSyedWaqas29510-Dec-12 0:17 
SuggestionFixed Telnet and added Serial connection metod Pin
cholegm28-Mar-12 2:56
membercholegm28-Mar-12 2:56 
NewsATTENTION: This project is outdated Pin
Elmue2-Nov-11 17:12
memberElmue2-Nov-11 17:12 
BugWhen i execute 2 doc commnds it work only for first... for second it always gives "More ?" kind of responce. Pin
prakash gajera17-Oct-11 4:12
memberprakash gajera17-Oct-11 4:12 
GeneralRe: When i execute 2 doc commnds it work only for first... for second it always gives "More ?" kind of responce. Pin
Member 440167625-Jan-13 11:37
memberMember 440167625-Jan-13 11:37 
QuestionDisconnect Pin
Member 42411152-Oct-11 12:31
memberMember 42411152-Oct-11 12:31 
AnswerRe: Disconnect Pin
Columbus-MCSD2-Oct-11 18:42
memberColumbus-MCSD2-Oct-11 18:42 
QuestionCapturing incoming data Pin
Columbus-MCSD16-Sep-11 6:25
memberColumbus-MCSD16-Sep-11 6:25 
QuestionMad props - a few questions. Pin
jtlutgen9-Sep-10 10:32
memberjtlutgen9-Sep-10 10:32 
AnswerRe: Mad props - a few questions. Pin
WuFei0727-Oct-10 11:25
memberWuFei0727-Oct-10 11:25 
GeneralRe: Mad props - a few questions. Pin
Columbus-MCSD2-Sep-11 1:30
memberColumbus-MCSD2-Sep-11 1:30 
QuestionHow to read output of command into some variable? Pin
Member 322335128-Jun-10 4:34
memberMember 322335128-Jun-10 4:34 
GeneralProblems with TerminalControl and Telnet Connection Pin
marcaurel198423-Jun-10 19:57
membermarcaurel198423-Jun-10 19:57 
GeneralRe: Problems with TerminalControl and Telnet Connection Pin
sdrey23-Jun-10 23:44
membersdrey23-Jun-10 23:44 
GeneralRe: Problems with TerminalControl and Telnet Connection Pin
marcaurel198424-Jun-10 0:39
membermarcaurel198424-Jun-10 0:39 
GeneralSerial Port Connection Pin
sdrey16-Jun-10 16:39
membersdrey16-Jun-10 16:39 
GeneralRe: Serial Port Connection Pin
Columbus-MCSD2-Sep-11 1:31
memberColumbus-MCSD2-Sep-11 1:31 
GeneralReading and hiding ansi escape sequence Pin
eldwinkhong12-May-10 21:59
membereldwinkhong12-May-10 21:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 2 Jan 2009
Article Copyright 2007 by Columbus-MCSD
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid