Learning Python Network Programming

(Sean Pound) #1

Network Programming and Python


An introduction to TCP/IP networks


The Internet protocol suite, often referred to as TCP/IP, is a set of protocols
designed to work together to provide end-to-end transmission of messages
across interconnected networks.


The following discussion is based on Internet Protocol version 4 (IPv4). Since the
Internet has run out of IPv4 addresses, a new version, IPv6, has been developed,
which is intended to resolve this situation. However, although IPv6 is being used in
a few areas, its deployment is progressing slowly and a majority of the Internet will
likely be using IPv4 for a while longer. We'll focus on IPv4 in this section, and then
we will discuss the relevant changes in IPv6 in second part of this chapter.


TCP/IP is specified in documents called Requests for Comment (RFCs) which are
published by the Internet Engineering Task Force (IETF). RFCs cover a wide range
of standards and TCP/IP is just one of these. They are freely available on the IETF's
website, which can be found at http://www.ietf.org/rfc.html. Each RFC has a number,
IPv4 is documented by RFC 791, and other relevant RFCs will be mentioned as
we progress.


Note that you won't learn how to set up your own network in this chapter because
that's a big topic and unfortunately, somewhat beyond the scope of this book. But,
it should enable you at least to have a meaningful conversation with your network
support people!


IP addresses


So, let's get started with something you're likely to be familiar with, that is,
IP addresses. They typically look something like this:


203.0.113.12

They are actually a single 32-bit number, though they are usually written just
like the number shown in the preceding example; they are written in the form of
four decimal numbers that are separated by dots. The numbers are sometimes called
octets or bytes because each one represents 8-bits of the 32-bit number. As such, each
octet can only take values from 0 to 255, so valid IP addresses range from 0.0.0.0 to
255.255.255.255. This way of writing IP addresses is called dot-decimal notation.

Free download pdf