Summary

After reading this chapter you are able to establish basic network communication using the TCP or UDP protocols, using Tcl code.

In this chapter, first, TCP connectivity was presented. Starting from the most basic blocking operation mode, we moved to nonblocking network handling based on event programming. Topics including binary data transfer, error handling or buffering issues were discussed along with appropriate examples. At the end, an alternative technique of programming based on threads was presented.

Next, the way how to handle UDP communication in Tcl was presented, with TclUDP extension as the implementation. The comparison of TCP and UDP philosophy was described, with the focus on the differences between streams and datagrams. ...

Get Tcl 8.5 Network Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.