5,448,104 members and growing! (16,086 online)
Email Password   helpLost your password?
General Programming » Internet / Network » General     Intermediate

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

By Sardaan Frostreaver

based on Poderosa Project http://sourceforge.net/projects/poderosa/
C#.NET 2.0, WinXP, Windows, .NETVisual Studio, VS2005, Dev

Posted: 6 Oct 2007
Updated: 6 Oct 2007
Views: 11,621
Bookmarked: 15 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
9 votes for this Article.
Popularity: 3.71 Rating: 3.89 out of 5
1 vote, 11.1%
1
0 votes, 0.0%
2
2 votes, 22.2%
3
2 votes, 22.2%
4
4 votes, 44.4%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

Introduction

My original project: http://www.codeproject.com/cs/internet/terminalcontrol.asp

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)

Background

This Library is an attempt at creating a library based on the "Poderosa" project

http://sourceforge.net/projects/poderosa/

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 descibed 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 expose certain elements so an application develop can simply drop the "Terminal Control.dll" into their 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 4 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 there 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:

if(GEnv.Connections.FindTag(_connection).ModalTerminalTask!=null) 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 TerminalPane's as we need.

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

History

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Sardaan Frostreaver



Location: United States United States

Other popular Internet / Network articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 14 of 14 (Total in Forum: 14) (Refresh)FirstPrevNext
Subject  Author Date 
QuestionVT100 or 3270 App to do some testsmemberManuel6423:51 8 Jul '08  
GeneralPonderosa version 4.0.2memberWMBWMB7:37 12 Jun '08  
GeneralWait for reply from Servermembercode30058:33 30 May '08  
Generalholy crapskees, you are the man!memberwaffle278:27 25 Apr '08  
QuestionDo you have a version for Visual Studio 2008?memberKarl Tarbet11:20 24 Jan '08  
GeneralA note about string resourcesmemberSardaan Frostreaver18:45 18 Oct '07  
Generalplease helpmemberSuperAbdo19805:23 11 Oct '07  
GeneralRe: please help [modified]memberSardaan Frostreaver19:40 11 Oct '07  
GeneralRe: please helpmemberSuperAbdo19801:53 16 Oct '07  
GeneralRe: please helpmemberSardaan Frostreaver18:19 18 Oct '07  
GeneralRe: please helpmemberSuperAbdo198022:30 23 Oct '07  
AnswerRe: please helpmemberAponilolo14:55 28 May '08  
GeneralUploaded Source CodememberSardaan Frostreaver21:04 9 Oct '07  
GeneralLoggingmemberSardaan Frostreaver19:42 8 Oct '07  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 6 Oct 2007
Editor:
Copyright 2007 by Sardaan Frostreaver
Everything else Copyright © CodeProject, 1999-2008
Web10 | Advertise on the Code Project