Skip navigation

PowerTCP

Tools Provide Easy Access to Common Internet Servers

asp:review

PowerTCP

Tools Provide Easy Access to Common Internet Servers

 

PowerTCP tools from Dart Communications are comprehensive tools you can include in your programs to perform common TCP/IP functions, including FTP, HTTP, SMTP, POP3, telnet, and SNMP. In addition, Dart supplies a series of other tools, such as a Zip compressor and a VT320 terminal emulator. This review, however, will focus only on two tools: the FTP Tool and the Mail Tool, which supports SMTP and POP3.

 

Each product comes with 30 days of free e-mail support, which covers installation, usage, and distribution issues. Dart also has a free support forum through which you can post questions and get answers from other PowerTCP users. Dart s development staff participates in the forums as time permits. Support packages are available starting at $249 per year per product. You can download a free 30-day evaluation copy of any PowerTCP tool from Dart s Web site.

 

Dart offers royalty-free run-time licenses for its products, meaning you may distribute these controls with your application without paying a licensing fee to Dart for each copy. There also are no restrictions on how you can use the tools, so you can use them on a Web site or in a forms-based Visual Basic program without restriction.

 

All of Dart s tools are based on COM technology, which means you can access them directly from a classic Windows or ASP program, or through COM Interop from a .NET program. They are implemented as ActiveX DLL files using apartment threading for concurrency and speed, which makes them perfect for ASP.NET applications.

 

The documentation associated with these tools is somewhat brief, but is very clear and understandable. Included with the documentation is information about the various protocols the tools use, plus simple sample programs that describe how to use the tools in a variety of programming languages.

 

Transferring Files with the FTP Tool

Dart s FTP Tool allows your program to work as an FTP client, which means you can move files to and from any FTP server just as you can with the Command Prompt FTP program. The FTP Tool supports both ASCII- and binary-file transfers. You can transfer one file at a time or multiple files with a call to a single method.

 

If you are familiar with the Command Prompt FTP program, you ll find it very easy to use this tool. Each command in the Command Prompt FTP program corresponds to a method, with the parameters of the command becoming arguments for the method. The options you can set in the Command Prompt FTP program are mapped to properties in the FTP Tool.

 

The following block of code will transfer a file from the client computer to an FTP server. The Timeout property allows the transfer to run for 60 seconds before the Progress event is triggered. You can use this event to abort the transfer or simply monitor the process. The Login method establishes a connection with the specified FTP server using the specified user ID and password. The Store method transfers the local file to the remote system. The Logout method closes the FTP connection:

 

Dim ftpc As New DartFTP.FTP()

ftpc.Timeout = 60000

ftpc.Login "ftp.JustPC.com", "FTPUser", "FTPPassword"

ftpc.Store "local.file", "remote.file"

ftpc.Logout

 

When the FTP Tool times out, the Progress event will be called. The Progress event includes arguments that indicate the current command being executed and its status, and that provide other information. From this information, you can determine what was happening when the tool timed out. Based on this information, you can permit the command to continue or abort.

 

If you specify a Timeout value of 0, the Progress event will fire periodically. Depending on why the Progress event was called, you can update a progress bar that indicates how much data was transferred, or execute another command. The main advantage of this approach to processing is that as soon as the command executes, control returns to the calling program. That means the user isn t forced to wait until the transfer is complete.

 

A Trace method is available to enable and disable the collection of debugging information. The Trace method can be useful in examining the protocol information being exchanged with the server.

 

FTP commands that result in a list of files (i.e., List and Directory) will return their results by using the ListEntries collection and the ListEntry object. This means you don t have to parse the information returned from the FTP server when you re looking for a particular piece of information for a file. You can access the raw information returned from the server in case the FTP Tool is unable to determine the format of the information returned.

 

The FTP Tool also works with most proxy servers. If the firewall isn t transparent, you can collect the necessary information from the user to specify the type of proxy server, and you can collect the login information necessary to pass through the proxy server.

 

ASP.NET programmers won t find this tool particularly useful because the client computer is the computer running the Web server instead of the end-user s computer running the browser. Thus, you can t move a file from the user s computer and your application with this tool. Visual Basic and C# programmers, on the other hand, may find a lot of value in this tool. When installed on a client computer, you can use the FTP Tool to transfer files to an FTP server for later processing.

 

Managing Mail with the Mail Tool

You can use the Mail Tool to download mail from a POP3 or IMAP4 server as well as send mail to an SMTP server. You can send and receive simple text messages, as well as complex messages with nested MIME encoded attachments.

 

The Message object is the fundamental unit you can manipulate. You can create a Message object explicitly using statements like the following:

 

Dim msg As New DartMail.Message()

msg.To.Add("[email protected]")

msg.To.Add("[email protected]")

msg.Subject = "Testing PowerTCP Mail Tools"

msg.AddAttachment("c:\Mailtest.txt")

msg.Text = "This is a test of the PowerTCP Mail Tool"

 

You can send messages to multiple users and add multiple attachments. The Mail Tool will format the message automatically based on the supplied information. After creating a new Smtp object, you set the timeout to a relatively large number, log in to the SMTP server, set the Message property to the message you want to send, and then use the Send method to send the message. For example:

 

Dim mailer As New DartMail.Smtp()

mailer.Timeout = 60000

mailer.Login("smtp.justpc.com")

mailer.Message = msg

mailer.Send()

mailer.Logout()

 

The Smtp object includes a Verify method that allows you to verify an e-mail address is correct by using a list of domain servers to verify the domain part of the e-mail address. If the domain is correct, then the remote computer is queried to determine if the e-mail address is correct. This tool may or may not result in a correct e-mail address, though, because many mail servers will accept any user name, even if it doesn t exist on the machine using the validate feature.

 

The Mail Tool supports both POP3 and IMAP4 mail servers by using the Pop and Imap objects respectively. The Imap object exposes its mail through the Mailboxes collection. Each item in the Mailboxes collection is a Mailbox object that corresponds to a folder on the IMAP4 server.

 

Through the Mailboxes collection, you can create and delete mail folders on the IMAP4 server and subscribe and unsubscribe to public mailboxes. The Mailbox property points to a Mailbox object that exposes the functions available for that particular folder. You can retrieve messages from the server using the Get method and send messages to the server using the Put method. The Search method will return a list of messages in the folder that match the specified search criteria. The Mailbox object also contains a reference to a Messages collection representing all of the messages stored in the folder.

 

The Pop object contains methods to retrieve and delete messages on the POP3 server. The Get method retrieves messages, and Delete will remove the specified messages from the mailbox. The Pop object exposes the messages retrieved from the server through the Messages collection.

 

The Messages collection contains the messages retrieved using the Get method. Each Message object represents a retrieved message. The following code retrieves all of the messages from the IMAP4 server s inbox. After logging to the server, the Get method is used to retrieve all of the mail in the INBOX mail folder. Then, after logging out, the code adds a summary of each message to the Messages collection:

 

Dim mymail As DartMail.Imap

mymail.Timeout = 60000

mymail.Login("imap.JustPC.com", "mailuser", "mailpassword")

mymail.Mailboxes.Item("INBOX").Get()

mymail.Logout()

For i = 0 To mymail.Mailboxes.Item("inbox").Messages.Count

   AddMailHeader(mymail.Mailboxes.Item("inbox").Messages.Item(i))

Next I

 

POP3 mail can be retrieved and processed in a similar fashion. However, the references to the Mailboxes can be deleted because the Messages collection is exposed directly by the Pop object.

 

Like the FTP Tool, the Mail Tool operates strictly as a client to the various mail servers. However, this is not nearly the limitation it is with the FTP Tool. You easily can develop a series of ASP.NET Web pages that log you onto a POP or IMAP server to download the mail and send mail via the specified SMTP server. Also like the FTP Tool, the Progress event can be used to track the progress of the file transfers and allow the main program to continue running without waiting for the transfer to complete.

 

The Mail Tool does a much better job than the FTP Tool does of abstracting the information from the low-level protocol, particularly the Message object. That includes the code necessary to encode and decode attachments to an e-mail automatically. This results in less work to include e-mail capabilities in your ASP.NET program.

 

Conclusion

Dart supplies a number of other Internet-based tools that impose a layer of abstraction between the using program and the actual Internet protocol being used. In many cases, this can be helpful to the programmer, as you can see from the Mail Tool. On the other hand, these tools duplicate some functions that are available in the .NET Framework and older COM components. For instance, much of the FTP Tool s capabilities are available in the COM Internet Transfer control, which also can be accessed by ASP.NET by using COM Interop. The ability to send mail via an SMTP server is available in the System.Web.Mail namespace.

 

Before using these tools, you need to evaluate your application to determine if you can meet its needs with the tools already available to you in the .NET Framework. If you can t, you have a choice whether you want to implement the Internet protocols yourself or take advantage of Dart s work. If you need to send or receive e-mail or move files using FTP, these tools are a bargain, especially because you have the right to redistribute the tools as part of your application.

 

Wayne S. Freeze is a full-time author with more than a dozen books to his credit, including his newest book, the ASP.NET Database Programming Bible (Hungry Minds, 2002). Other books he has written include Windows Game Programming with Visual Basic and DirectX (Que, 2001), the Visual Basic 6 Database Programming Bible (Hungry Minds, 2000), and the Expert Guide to Visual Basic 6 (Sybex, 1998). He has more than 25 years of experience using all types of computers, from small, embedded microprocessor control systems to large-scale IBM mainframes. Wayne has a master s degree in management information systems as well as degrees in computer science and engineering. You can visit Wayne s Web site at http://www.JustPC.com, and send him e-mail at mailto:[email protected].

 

asp:factfile

PowerTCP is a collection of Internet tools that provide easy access to common Internet servers, such as FTP, POP3, IMAP4, SMTP, and Web servers. These controls provide you with an object-oriented approach that encapsulates the lower-level protocols that minimize the amount of work necessary to incorporate them into an ASP.NET application.

 

Dart Communications

111 Dart Circle

Rome, NY 13441

 

Rating:

Price: Mail Tool, US$499 (version 2); and FTP Tool, US$249. A 30-day trial version is available for download.

Phone: (315) 339-8040

E-Mail: mailto:[email protected]

Web Site: http://www.dart.com

 

Tell us what you think! Please send any comments about this review to [email protected]. Please include the review title and author.

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish