■ INTRODUCTION
xviii
Introduction
You have chosen an exciting moment in computing history to embark on a study of network
programming. Machine room networks can carry data at speeds comparable to those at which machines
access their own memory, and broadband now reaches hundreds of millions of homes worldwide. Many
casual computer users spend their entire digital lives speaking exclusively to network services; they are
only vaguely aware that their computer is even capable of running local applications.
This is also a moment when, after 20 solid years of growth and improvement, interest in Python
really seems to be taking off. This is different from the trajectory of other popular languages, many of
which experience their heyday and go into decline long before the threshold of their third decade. The
Python community is not only strong and growing, but its members seem to have a much better feel for
the language itself than they did a decade ago. The advice we can share with new Python programmers
about how to test, write, and structure applications is vastly more mature than what passed for Pythonic
design a mere decade ago.
Both networking and Python programming are large topics, and their intersection is a rich and
fertile domain. I wish you great success! Whether you just need to connect to a single network port, or
are setting out to architect a complex network service, I hope that you will remember that the Internet is
an ecosystem that remains healthy so long as individual programmers honor public protocols and
support interoperability so that solutions can grow, compete, and thrive.
Writing even the simplest network program inducts you into the grand tradition started by the
inventors of the Internet, and I hope you enjoy the tools and the power that they have placed in our
hands. I like the encouragement that John Goerzen, the author of the first edition of this book, gave his
readers in his own introduction: “I want this to be your lab manual—your guide for inventing things that
make the Internet better.”
Assumptions
This book assumes that you know how to program in Python, but does not assume that you know
anything about networking. If you have used something like a web browser before, and are vaguely
aware that your computer talks to other computers in order to display web pages, then you should be
ready to start reading this book.
This book targets Python versions 2.5, 2.6, and 2.7, and in the text I have tried to note any differences
that you will encounter between these three versions of Python when writing network code.
As of this writing, the Python 2 series is still the workaday version of the language for programmers
who use Python in production. In fact, the pinnacle of that line of language development—Python 2.7—
was released just a few months ago, and a second bugfix release is now in testing. Interest in the
futuristic Python 3 version of the language is still mostly limited to framework authors and library
maintainers, as they embark on the community's several-year effort to port our code over to the new
version of the language.
If you are entirely new to programming, then an Amazon search will suggest several highly rated
books that use Python itself to teach you the basics. A long list of online resources, some of which are
complete e-books, is maintained at this link: wiki.python.org/moin/BeginnersGuide/NonProgrammers.