Add Telnet to Your .NET Apps
by Leonard Lobel


Quick Facts
PowerTCP Telnet for .NET
Dart Communications
Web: www.dart.com/dotnet/telnet.asp
Phone: 315-339-8040
Price: $349
Quick Facts: A set of controls for implementing Telnet and remote access protocols in .NET applications.
Pros: Easy to use; powerful; many features.
Cons: None.

PowerTCP Telnet for .NET from Dart Communications lets you add streaming Telnet functionality easily to your .NET apps. You can drop a Telnet control onto a VS.NET design surface to instantiate a ready-to-use, module-scoped object in your code immediately. If you prefer, you can set a reference to the control's assembly and hand-code your instantiation. This approach gives you total control over object scope, creation, and lifetime, but requires you to add a licenses.licx file to your project and code event handlers manually (see Figure 1).

The product supports both synchronous and asynchronous modes. Synchronous operation addresses most typical requirements. You invoke the Receive method to block execution until a server response is received. Setting the DoEvents property allows your app to process other events while execution is blocked, so you don't need to resort to asynchronous mode to handle them.

Asynchronous operation runs in the background. Invoking the BeginReceive method spawns a worker thread and causes your app to continue while the server response arrives in parallel execution. The worker thread raises the EndReceive event when it's done, so your app can handle the success or failure of the operation accordingly.

Other useful features include a Login method that encapsulates an entire server login conversation, a WaitFor method for easy scripting, automatic option negotiation (you can disable this if necessary), and a TelnetStream class that extends the generic Stream class by performing Telnet-specific formatting of data passing through the stream.

Much of the Telnet control's functionality derives from a base TCP class. This thoughtful design results in consistent operation and behavior across other Dart communication controls that also inherit from TCP.

Three other controls—Rexec, Rlogin, and Rsh—provide the remote login, execution, and shell protocols that Unix hosts typically support. These controls are extremely easy to use with a single method call. They too support asynchronous mode.

The online help is clear and thorough. Concise code samples in VB.NET and C# show how to perform most common tasks. Unfortunately, the sample code refers to classes in the Dart namespace without mentioning or including an appropriate Imports statement. The code works only if you add the Imports statement, or if you prefix the class names in the code with a fully qualified namespace. Otherwise, the documentation and code samples are well-written and easy to follow. You'll also find working demos for all four controls in VB.NET and C#, and an ASP.NET demo that requires additional setup in Internet Information Services.

PowerTCP Telnet for .NET is an excellent product that deserves a place in any serious developer's toolbox.

About the Author
Leonard Lobel is the CEO and founder of Sleek Technologies, a development shop specializing in Microsoft-based solutions, and the director of software for Government Data Publications in New York. Lenni is also a consultant and trainer with more than 24 years of experience. Reach him at .


Store and Share Code
by Don Kiely


Quick Facts
CodeBox for .NET
VB2TheMax
Web: www.vb2themax.com
Price: $79 for Pro version, $159 for Enterprise version
Quick Facts: Handy code repository with rich features for storing, documenting, and finding code.
Pros: Effective UI; export to HTML; can use almost any data store.
Cons: Minor limitations on some features.

Code reuse is the holy grail of software development, and .NET's robust support for object-oriented programming lets you leverage existing code effectively. It would be great to have a way to save the code snippets you don't need right now but might later in the project, or to store cool code you find online for future use. VB2TheMax's CodeBox for .NET might be the answer.

CodeBox is a standalone tool for storing, accessing, and documenting categorized code, making it easy to share the repository with other developers. You can store code snippets in VB.NET and/or C#; save entire modules; include notes about the code; and attach files, such as Word documents and ZIP files (see Figure 1). You can bookmark any code items—without adding them to your Internet Explorer favorites list—and perform flexible searches for code.

The repository can be an Access file, SQL Server database, or any other database you can access with OLE DB, although CodeBox is integrated most closely with Access. It provides an update feature that lets you download new or updated code that the VB2TheMax team publishes. You can merge code from multiple CodeBox repositories, but the product doesn't filter duplicate code.

One of CodeBox's nicest features is that you can export an item to an HTML page, complete with the VB.NET and C# code, examples, notes, and dependencies. This has some interesting possibilities for documentation, although this version of CodeBox can export only one item at a time. It would be nice to export an entire category at once, at the least.

You'll probably find lots of good uses for CodeBox. I used to think of its class of tools as a way to store my own code snippets along with any the product provides. CodeBox is even more versatile. It lets you store useful code and other files you get from magazines and online sources. You might not have an immediate use for these items, but you know where to find them when you need them.

I'd love to see a few additional features in CodeBox. The UI doesn't have a way to create a new SQL Server-based repository. You can get the SQL script files to do this, but it really should be automated. Also, exporting all code items to a Web site would be a great way to enable documentation and use of the code.

Nevertheless, CodeBox is a well-designed and well-implemented utility you'll find more uses for every day. An enterprise version comes with 20 licenses and the .NET source code, all for only twice the cost of the single-license, standalone version. With the source code, you can modify CodeBox and even set up a service to distribute code updates internally in your organization.

About the Author
Don Kiely is a senior technology consultant. When he isn't writing software, he's writing about it, speaking about it at conferences, and training developers in it. Reach him at .