In my previous post I created a very basic telnet only application. So in order to add some new features to the application I will be using the ExtraPutty library.
We need to leverage the ExtraPuTTY.dll in order to use it’s functions in C#. So because ExtraPuTTY.dll is not a COM .dll we can use the DllImport attribute to call the functions within the library.
You can use dependency walker to take a closer look at the methods within a .dll file. This is especially useful when you’re building a program and want to see the capabilities of the library you are using.
Writing a small app to communicate over telnet has never been easier. Of course you could just download Putty or use Telnet in Windows CMD but wheres the fun in that?
Writing your own app has tons of perks, automation is what comes to mind… It’s common for programmers to have small helper scripts (for instance running batch scripts in windows to automate installations etc.) but windows .bat and PowerShell scripts can be limiting at times. Especially when you want the user to be amazed by your custom GUI.
ConsoleControlallows us to embed a CMD terminal into our Windows Forms or WPF application. In this case we are using Windows Forms. TentacleSoftware.Telnet is a Telnet library making connecting to the device much easier since we don’t have to write our own sockets protocol etc.