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. We mentioned the limitations of both the UDP protocol and TclUDP
package, and how to avoid some common pitfalls.
The contents of this chapter provided you with a knowledge of Tcl's philosophy when it comes to programming network operations, and constitute...