Tcl 8.5 Network Programming

Tcl 8.5 Network Programming
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Develop network-aware applications with Tcl
  • Implement the most important network protocols in Tcl
  • Packed with hands-on-examples, case studies, and clear explanations for better understanding

Book Details

Language : English
Paperback : 588 pages [ 235mm x 191mm ]
Release Date : July 2010
ISBN : 1849510962
ISBN 13 : 9781849510967
Author(s) : Wojciech Kocjan, Piotr Beltowski
Topics and Technologies : All Books, Networking and Servers, Networking & Telephony, Open Source, Web Services

Table of Contents

Chapter 1: Introducing Tcl
Chapter 2: Advanced Tcl Features
Chapter 3: Tcl Standalone Binaries
Chapter 4: Troubleshooting Tcl applications
Chapter 5: Data Storage
Chapter 6: Networking in Tcl
Chapter 7: Using Common Internet Services
Chapter 8: Using Additional Internet Services
Chapter 9: Learning SNMP
Chapter 10: Web Programming in Tcl
Chapter 11: TclHttpd in Client-Server Applications
Chapter 12: SOAP and XML-RPC
Chapter 13: SSL and Security
  • Chapter 1: Introducing Tcl
    • What is Tcl/Tk
      • Extensions
      • Tk
    • Installation
      • Windows
      • Unix-like systems
      • Installation of additional Tcl packages
    • Additional tools
      • Eclipse
      • Komodo
      • tkcon – an alternate Tcl shell
    • Tcl syntax
      • Tcl commands documentation syntax
      • Running the script
      • Running commands directly in the tclsh interpreter
      • Variables
      • Grouping
      • Nesting commands
      • Data types
        • Lists
        • Arrays
        • Dictionaries
        • Mathematical expressions—expr
        • Flow control and loop instructions
        • Defining your own commands
    • Summary
  • Chapter 2: Advanced Tcl Features
    • Tcl features
      • Working with time and date
      • Tcl data types
      • Global, namespace, and local variables
      • Stack frames
    • Object-oriented programming
      • Class definition
      • Inheritance
      • Object definitions
      • Using mixins
      • Forwarding methods
      • Additional information
    • Accessing files
      • Reading and writing files
      • Configuring channel options
      • File management
      • Filename related operations
      • File information
      • Listing files
      • Current working directory
    • Packages in Tcl
      • Package loading
      • Creating a package
      • Tcl modules
    • Event-driven programming
      • Tcl event types
      • Entering the event loop
      • Events and stack frames
      • Channel events
      • Timer and idle events
      • Robust scheduling with tclcron
    • Multithreaded applications
      • Managing threads
      • Shared variables
      • Transferring channels
    • Summary
  • Chapter 3: Tcl Standalone Binaries
    • Understanding the executable file structure
    • Learning the Metakit database
      • Working with MetaKit from Tcl
    • Learning more about virtual file systems
      • Getting into the details of VFS and Metakit
    • Learning Tclkit
    • Starkit and SDX
      • Creating a Starkit file
      • Internal structure of starkits
        • Using resource files in starkits
        • Putting additional packages into a starkit
      • Format of the starkit file
      • Interactions between different starkit files
    • Knowing the Starpack technology
    • Practical example—the Hibernator application
    • Advanced topics—self updating
    • Other solutions
    • Summary
  • Chapter 4: Troubleshooting Tcl applications
    • Logging
      • Log package
        • Initialization
        • Available log levels
        • Enabling or disabling log levels
        • Replacing the default implementation of the logging command
        • Recap of the log package
      • Logger package
        • Initialization
        • Available log levels
        • Enabling or disabling log levels
        • Tracing
        • Changing the implementation of the logging / tracing command
        • Appenders
        • Recap of the logger package
      • Audit
        • Recap of the audit package
    • Debugging
      • Tcl Dev Kit Inspector
      • Tcl Dev Kit Debugger
        • Local Debugging
        • Remote debugging
        • Recap of the Tcl Dev Kit Debugger
      • TclPro Debugger
    • Summary
  • Chapter 5: Data Storage
    • Internationalizations
      • Encoding issues
      • Translating your application into different languages
    • Using SQL and databases in Tcl
      • Connecting to MySQL
      • Connecting to PostgreSQL
      • Using SQLite
        • Managing databases from SQLiteStudio
      • Other databases
    • Handling XML in Tcl
    • Storing raw Tcl values
    • Summary
  • Chapter 6: Networking in Tcl
    • Using TCP sockets
      • Creating server sockets
      • Connecting over TCP
      • Using nonblocking sockets
        • Handling channel events
      • Transferring binary data
        • Transferring data using the fcopy command
      • Handling errors
      • Buffering
      • Using threads for networking
        • Using threads and thread pools
        • Connecting to our service
    • Using UDP sockets
      • Creating a UDP-based client
      • Implementing service using UDP
      • Sending reliable messages
      • Comparing TCP and UDP: streams vs. datagrams
    • Summary
  • Chapter 7: Using Common Internet Services
    • Handling e-mail
      • Learning MIME
        • Content type
        • Multipart messages
      • MIME in Tcl
        • Creating messages
        • Multipart elements
      • Sending e-mails
        • Automated e-mail sending
        • Creating template based e-mails
      • Receiving e-mails
        • Using POP3 protocol in Tcl
        • Listing all messages
        • Retrieving e-mails using POP3
        • Parsing incoming e-mails
    • Transferring files and data
      • Resources and uri package
      • Using HTTP
        • Retrieving data over HTTP
        • Submitting information using GET and POST
        • Advanced topics
        • Cookies in Tcl
        • HTTP and encryption
        • Retrieving RSS information
      • Using FTP
        • Establishing connections
        • Retrieving files
        • Uploading files
        • Listing files and directories
    • Summary
  • Chapter 8: Using Additional Internet Services
    • Checking DNS
      • Using callbacks
    • Getting the current date and time
    • Using LDAP from Tcl
      • Authenticating users over LDAP
      • Modifying information in LDAP
    • Communicating with Tcl applications
      • Comm client and server
      • Performing commands asynchronously
      • Security aspects
      • Limiting available commands
    • Summary
  • Chapter 9: Learning SNMP
    • Introduction to SNMP
      • Learning SNMP protocol versions
      • Data objects
      • Working with SNMP and MIB
      • Setting up SNMP agent
    • Tcl and Scotty package
      • Obtaining Scotty
      • The TkIned application
    • Using Tcl for SNMP communication
      • Querying SNMP in Tcl
      • Performing asynchronous queries
      • Walking over MIB trees
      • Receiving traps
      • Sending traps
      • SNMP agent
      • Additional features
    • Summary
  • Chapter 10: Web Programming in Tcl
    • Tcl scripts as CGI application
      • Using ncgi package
      • Using html package
    • Introduction to TclHttpd
      • Installation
        • Retrieving source code from the CVS repository
      • Documentation
      • First run
        • Startup parameters
      • Default directory structure
      • Configuration
      • Performance
    • Programming TclHttpd server
      • Providing static content
      • Using CGI in TclHttpd
      • Mapping URL to application
      • Creating document type handlers
        • Using the watermark example
        • Creating custom templates
      • Learning domain handlers
        • Comparing domain handlers to application direct URLs
        • Creating session-based authentication
      • Using the TclHttpd template system
      • Securing access to resources
      • Debugging TclHttpd server
      • Embedding TclHttpd in your application
    • Summary
  • Chapter 11: TclHttpd in Client-Server Applications
    • Creating HTTP-based applications
      • Preparing source code structure
      • Creating our applications
        • Server-side
        • Client-side
      • Communication and registration
        • Server-side
        • Client-side
      • Storing information
        • Server side
        • Client side
      • Comm interface—spooling jobs
      • Testing our applications
    • Adding autoupdate to application
      • Server-side
      • Client-side
    • Extending your applications
      • Starkits as extensions
      • Building modules
      • Server side
      • Handling modules on client
      • Communication with server
    • Improving scalability and performance
    • Summary
  • Chapter 12: SOAP and XML-RPC
    • Tcl and standards for remote procedure calls
    • Connecting to XML-RPC services
      • Defining available methods
      • Specifying data types
      • Using XML-RPC
  • Using SOAP protocol
    • Creating Web Services
      • Setting up server
      • Creating a service
      • Specifying data types
      • Creating service methods
      • Defining data types
      • Using data types inside service
    • Connecting to SOAP based services
      • Invoking methods via commands
      • Invoking methods API using DoCall commands
      • Using complex data types
  • Summary
  • Chapter 13: SSL and Security
    • Learning Secure Socket Layer
      • Using SSL from Tcl
      • Generating self-signed certificates
      • Setting up and using public key infrastructure
        • Setting up certificates manually
        • Automating certificates from Tcl
      • Managing certificates from Tcl
        • Server side
        • Client side
        • Testing our solution
      • SSL and performance issues
    • Authorization and roles
    • Securing your application
      • Slave interpreters
        • Using slave interpreters
        • Sharing information with the slave interpreter
        • Creating and managing aliases
        • Deleting interpreters
        • Imposing limits on interpreters
      • Working with safe interpreters
        • Hiding and exposing commands
        • Default safe interpreter setup
        • Using Safe Base
        • Safe Base and filesystem access
      • Role-based authorization and interpreters
        • Creating interpreters using roles
        • Sample role definitions
        • Using role-based interpreters
    • Summary

Wojciech Kocjan

Wojciech Kocjan is a system administrator and programmer with 10 years of experience. His work experience includes several years of using Nagios for enterprise IT infrastructure monitoring. He also has experience in large variety of devices and servers, routers, Linux, Solaris, AIX servers and i5/OS mainframes. His programming experience includes multiple languages (such as Java, Ruby, Python, and Perl) and focuses on web applications as well as client-server solutions.

Piotr Beltowski

Piotr Beltowski is an IT and software engineer, co-author of several US patents and publications. Master of Science in telecommunications, his technical experience includes various aspects of telecommunication, like designing IP networks or implementing support of network protocols. Piotr's experience as Level 3 customer support lead makes him focused on finding simple solutions to complex technical issues.

His professional career includes working in international corporations such as IBM and Ericsson.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Tcl 8.5 Network Programming +    Haskell Data Analysis Cookbook =
50% Off
the second eBook
Price for both: $43.05

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Get to know the the tools available to ease up development of Tcl code
  • Discover Tcl’s approach of using events over threads, which is very different from many other languages
  • Learn the VFS feature that allows the usage of Metakit database as normal file system
  • Create loggers, define log levels, write your logs to file or channel, and trace the execution of your code
  • Get to know the key differences between free TclPro Debugger and paid ActiveState Tcl Dev Kit Debugger
  • Handle different text encoding, dependent on the region you live, and create multi-language, internationalized application with msgcat package
  • Handle UDP communication in Tcl was presented, with TclUDP extension as the implementation
  • Manage files remotely over File Transfer Protocol (FTP) and learn to download a file from a web site using Hypertext Transfer Protocol (HTTP),
  • Learn the usage Lightweight Directory Access Protocol (LDAP) to look up information and/or authenticate users, manually querying host names and time servers
  • Get to know the Tcl package Scotty that handles SNMP and provides a Tk based GUI application that can be used for inspecting devices, discovering systems within our network and browsing data that can be retrieved over SNMP
  • Use Tcl code as legacy CGI scripts and improve it with ncgi package
  • Create client-server application based on HTTP protocol and Tclhttpd as embedded web server packed into Starkit technology for easy deployment
  • Connect to XML-RPC services and issue methods remotely, and easily integrate with major blogging engines
  • Create SOAP services using Tclhttpd and Web Services for Tcl; define complex data types for storing structured information
  • Learn to use encrypted connections from Tcl and the method to make sure you know whom your application is communicating with

In Detail

Tcl (Tool Command Language) is a very powerful and easy to learn dynamic programming language, suitable for a very wide range of uses. Tcl is regarded as one of the best-kept secrets in the software industry. This book gives you a hands-on experience on Tcl, helping you develop network-aware applications using this mature yet evolving language.

This book shows you how to create network-aware applications with Tcl language. Packed with practical examples, the book not only takes you through the implementation of network protocols in Tcl, but also key aspects of Tcl programming.

The book starts with the basic element of Tcl programming as we take a look at the syntax and fundamental commands of the language. To get us ready for network programming, we look at important Tcl features such as object-oriented programming, accessing files, packaging in TCL, event driven programming, and multithreaded applications. To create standalone single-file executable applications with Tcl we take a look at the Starpack technology, and ensure that we’ll be able to create robust applications with a thorough coverage of troubleshooting and debugging Tcl applications.

The book is really about network programming, and it will not let you down with its deep coverage of these topics. Of course we look at protocols, but there are plenty of practical examples to keep things moving along. We start with the TCP and UDP protocols, and look at some other protocols to see examples of synchronizing time with other servers, querying user information and authenticating users over LDAP and performing DNS queries.

The book explains Simple Network Management Protocol (SNMP), which is often used for monitoring and gathering information from various devices, such as routers, gateways, printers and many other types of equipment. We’ll also look at web programming in Tcl; processing the requests coming from the clients via the HTTP protocol and responding to these requests. You’ll be able to create a complete solution for creating a client-server application in Tcl.

To round things off, you’ll see how to secure your networked applications, build public key infrastructure into your application and use Tcl’s safe interpreter feature to reduce risk of running code from unknown source.

This book will be help you discover a range of network protocols and concepts and show how to implement them in Tcl


The book is written so that both experienced and novice Tclers can find useful information inside. It starts with quick introduction to Tcl and its networking support for those who are less familiar with them.

Authors focus on showing practical, yet simple examples for each module and command described so that reader understands how to use them when solving the real life problems. The examples given are useful programs that try to solve real-world needs. All sample programs are clear and concise yet nothing essential is left out and the programming style focuses on readability rather than on stylistic rigor or efficiency.

Who this book is for

This book is for Tcl developers with basic network programming concepts, who want to add networking capabilities to their applications. Working knowledge of Tcl and basic experience of network protocols will be useful. The reader should be familiar with basic concepts used in modern networking – keywords like TCP, HTTP or XML should not be a mystery. The book does not require advanced knowledge of Tcl – the first chapters will swiftly introduce the reader into it, allowing refreshing the information or gaining a quick overview of the Tcl language abilities.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software