The last chapter walked through Perl's built-in interface to Berkeley sockets, which closely mirrors the underlying C-library calls. Some of the built-in functions, however, are awkward because of the need to convert addresses and other data structures into the binary forms needed by the C library. The advent of the object-oriented extensions to Perl5 made it possible to create a more intuitive interface based on the IO::Handle module. IO::Socket and related modules simplify code and make it easier to read by eliminating the noisy C-language- related calls and allowing you to focus on the core of the application. This chapter introduces the IO::Socket API, and then walks through some basic TCP applications. |