Tcl Network ProgrammingBuild network-aware applications using Tcl, a powerful dynamic programming languageWojci. Learn Tcl and you'll never look back when it comes to developing network-aware applications. This book is the perfect way in, taking you from. [PDF] Tcl Network Programming: Build network-aware applications using Tcl, a powerful dynamic programming language. Tcl Network Programming.
|Language:||English, Spanish, French|
|Genre:||Children & Youth|
|Distribution:||Free* [*Registration Required]|
s Effective Tcl/Tk Programming Web-based Tcl/Tk Courses available: s The pppstats program prints out statistics for a PPP network connection s We can. P U B L I S H I N G community experience distilled Tcl Network Programming Wojciech Kocjan Piotr Beltowski Chapter No.7 "Using Common Internet. Tcl Network Programming pdf download | PDF RAR Tcl Network Programming by Wojciech Kocjan and Piotr Beltowski Packt Publishing.
Many companies run their business by sending customized information to their customers and need a robust system that can send large volumes of s, which handles failures of servers and needs to be customizable from both business logic and template perspectives.
If we plan on sending messages, we need to automate the process of building them and creating a system that will allow other people to customize both content and the appearance of our s.
We can either create a set of standalone tools or libraries that we can then use in our applications, depending on our needs. One of the most important things that such an application will offer is an easy way to change contents of messages easily. In many cases, it is enough to have a separate directory for content of a message along with standardized file naming.
Creating template based s For example, let's assume our messages are stored in a separate directory.
Files called message. The subject of the message is in the subject. We'll also assume our messages are in UTF-8 encoding, which allows support for various encodings around the world. Let's start with creating a namespace, and create a procedure called readtext for reading text files.
This procedure will also use the subst command to allow substitution of commands and variables. We'll also load packages that we'll use throughout this example and initialize the proper namespace, which is needed before creating any procedures within that namespace: For example, we can add this to our HTML part of the message: We can use it for passing data to our templates as dictionaries.
For example, if we were to send a notification that a payment is due, data would contain first name, last name, and other information about the recipient, and the amount and payment date. Our template would then include these values in the text by using dict get command as seen in this section.
We've loaded the uuid and fileutil:: The first one is used to generate the message's unique identifier, whereas the second one is used to get the MIME content type from files, so that these don't have to be specified explicitly by template providers. It also accepts an optional list of attachments, which allows us to add additional files, such as invoices as PDF files, if this is needed.
The first step is to read the subject and both versions of messages. We'll also make sure that the subject does not include any newline characters as this will create errors when either building or parsing the message. We do this by splitting the subject into a list of lines and choose the first element from that list. Please note that, at this point, our messages are already formatted using the data that was provided. This step is very similar to how it was previously built for our first message.
We create a list of parts and add only one element to it for now the actual HTML part. The variable file contains full path to the file and filename contains just the filename. We specify that this item should be added inline and that its identifier is set ftype [fileutil:: We initialize it to just one element the result from previous step, the complete message containing plaintext, HTML, and images added inline.
Now we iterate through the list of attachments, taking two elements from the list at a time.
The first one is the path to attachment file and the second one is the name that will be shown to the recipients. Chapter 7 set ftype [fileutil:: Setting the Subject header before sending the message is different from the previous example. Although the From, To, Cc and Bcc fields should be set during the smtp:: Now that we have completed our code for preparing the messages, we can proceed with adding a small piece of code to send it: We're also passing two values to the message firstname and lastname.
If we want to send an attachment, all we need to do is add such a list to the template:: It has to contain subject.
The directory can also contain files that should be embedded as part of the message. The list provided as the last argument is the list of attachments to include. While the actual file is called attachment. The example in this section is located in the 03 template directory in the source code examples for this chapter.
It also contains a sample template that uses data variables for passing information. Documentation on mime and smtp packages can be found on the tcllib project website at SourceForge: One example is that if we send out mass s to users, we might also want to be able to receive messages for unsubscribing from them and process them.
Also, our application can also receive "delivery failed" notifications and process them for example, starting with temporarily not sending messages and ending with removing failing addresses from our records permanently. One of the most flexible options is to set up a dedicated SMTP server that will accept s from other systems. This option, however, requires more setup and is discussed in the next chapter.
A simpler option that will allow us to receive s is to use existing servers and read s from them. In order to read over POP3, we need to know the POP3 server name, and the username and password required to access our account. Usually, this is provided by our system administrators. POP3 works so that applications connect, list and read messages, delete the ones they have already read, and then disconnect. This is then repeated periodically. POP3 uses positive integers to identify all messages.
These messages range from 1 to the number of messages therefore, if our inbox has 23 messages, they are 1, 2, 3, Throughout the entire connection to a POP3 server, each number is guaranteed to point to the same message.
Therefore, until we disconnect, message 19 will always point to the same message. If we delete a message, we can no longer reference that particular message, but all other messages will still have the same index for example, if we delete message 4, messages from 5 and up will still have the same identifiers.
Also, when new messages arrive during our connection to the server, our connection will not be able to access them. POP3 is designed so that the application logs in, reads messages, and disconnects. Our program might be doing this frequently, but it should always set up a new connection to the server. In order to initialize a connection, we need to run the pop Optionally, we can specify the TCP port to connect to as the next argument, otherwise the POP3 default port is the used.
This command returns a channel that is used by all other commands from this package. For example, the following will connect to your Gmail account: This token is used by all other commands from the pop3 package and is always passed to these commands as the first argument. The first one is -socketcmd, which allows us to specify the command that should be used for creating the socket. Its main use is to support Secure Socket Layer SSL and for providing a command that connects using a proxy server if this is needed.
If this is the case, the POP3 package needs to work around some non-standard behavior that occurs when communicating with a Microsoft Exchange server. Having the channel to a mail server open, we can now retrieve information. The command pop It returns two numbers the first one being number of messages in your inbox and the second one specifies the total number of bytes used by all messages.
The command lassign is described in more detail in Chapter 1. The number of messages specifies both how many messages are present in our inbox as well as the maximum value that we can use for specifying message identifier. Listing all messages We can also list all messages by receiving either their sizes or their unique identifiers.
The list consists of two elements for each message its identifier integer number and size in bytes. For example, in order to list size of all messages, we can run the following: Chapter 7 Please note that unique identifiers might not be supported by all servers and this command might return an error in this case. Otherwise, these identifiers allow for identifications of s across POP3 sessions.
The POP3 standard does not define the format of these identifiers, so our application should not assume anything about it and about the ways of comparing identifiers. Unique identifiers combined with a persistent storage can be used to track which messages are new and should be processed, and which ones our application has already processed. This is especially useful if our application does not delete messages after receiving them.
Retrieving s using POP3 Once we know which messages we want to retrieve, we can either retrieve just part of the message or the entire message. In order to retrieve headers and part of the message, we can use the pop It accepts the POP3 channel, the number of the message, and the number of lines from the actual message to retrieve. For example, in order to retrieve the headers and 5 topmost lines from the first message, we can run the following: This command always returns a list of the messages, even if only one index was specified.
For example, we can retrieve and print the entire first message by running: In this case, the command will retrieve multiple messages and return a list containing them. For example, we can retrieve messages 1, 2, and 3 by running: The special index start means the first message and is the same as 1.
The special index end specifies the last message, based on how many messages are present on the server. The same values can be retrieved using the pop Deleting one or more messages can be done using the pop It accepts the channel name, followed by one or two indexes. Similar to pop If two indexes are specified, then multiple messages are deleted.
The special keywords start and end can also be used.
For example, deleting all messages can be done by invoking: When we have finished working with our remote s, we should close the connection.
The only argument it needs is the POP3 channel name. This can be done by using the mime package for this purpose, similar to how we built messages. In order to have the mime package parse an already built message, we can use the mime:: It will parse the message, parse headers,and split it into appropriate parts if we don't provide the -canonical flag.
Electronic mail exchanges information between people and file. Information in this document is subject to change without notice.
Companies, names,. SFWR 4C Kartik Krishnan Lectures Remote login Telnet: Telnet permits a user to connect to an account on a remote machine. A client. Distribute reports and documents Networking Dr.
Ayman A. Email Basics: Email protocols were developed even before there was an Internet, at a time when no one was anticipating widespread use of digital graphics or even rich text format fonts, colors, etc. This document describes its implementation and. John A. Montgomery Adapted to OS X by: Email Electronic Mail Electronic mail paradigm Most heavily used application on any network Electronic version of paper-based office memo Quick, low-overhead written communication Dates back to time-sharing.
All rights reserved. IceWarp Unified Communications Version It is well known for its stability and around the clock availability. PageR can help users. Getting Started FaxFinder FFx30 T. The FaxFinder fax server accepts. All Rights Reserved. FileMaker, Inc. NET Framework 4. This section covers implementation considerations. There are limitations to embedding documents in standard e-mails. PrintBoss solves these. WebSpy Vantage Ultimate 2.
For more detailed information, please see. Elements of Email Email Components There are a number of software components used to produce, send and transfer email.
These components can be broken down as clients or servers, although some components. Table of contents 1 Overview It is necessary for vendors. Course B: All trademarks are the property of their respective owners.
Features and specifications. Workflow Conductor Widgets Workflow Conductor widgets are the modular building blocks used to create workflows in Workflow Conductor Studio. Some widgets define the flow, or path, of a workflow, and others. Patrick LeBlanc. Gray Hat Python. Justin Seitz. Oracle GoldenGate 11g Implementer's guide. John P Jeffries. STL Pocket Reference.
Ray Lischner. Ritesh Shah. Luc Dekens.
Advanced C Concepts and Programming. DB2 Essentials. Raul F. Bob Bryla. Kalen Delaney. Certification Study Guide. Susan Lawson. DB2 Certification Study Guide Exam Roger Sanders. Zend Framework 2 Cookbook. Josephus Callaars. Definitive XML Schema. Priscilla Walmsley. Mohankumar Saraswatipura. MySQL Troubleshooting. Sveta Smirnova. Tony Northrup.
DB2 9 Fundamentals. Roger E. Implementing Samba 4. Marcelo Leal. PowerShell 3. Sherif Talaat. Programmer's Guide to Drupal. Jennifer Hodgdon. Java Network Programming. Elliotte Rusty Harold. Curtis Reese. Brian Overland. Wisnu Anggoro. Eclipse Modeling Framework. Dave Steinberg. Understanding DB2. Xiaomei Wang. Essential System Administration Pocket Reference. Beginning T-SQL. Kathi Kellenberger. Sam R. Robert van den Nieuwendijk.
Oracle GoldenGate 11g Handbook. Robert G. JBoss AS 5 Development. Spring Security 3. Robert Winch. IBM DB2 9. They even share version numbers. About the Tcl language Tcl is an interesting language; it has a number of somewhat unusual features, compared to other programming languages.
Tcl has no reserved words or control structures. While this is not usually advisable, it is very powerful. All the data types in Tcl can be treated as strings because, in an important way, they are strings. Even source code can be manipulated as a string.
The integer 2 and the string "2" are the same value.
The value 2 is an integer when passed as an argument to a command that is meaningful for integers. If "hello" is passed to a command that treats the argument like an integer, the result will either be nonsense or an error.