4. Network Client Development¶
Now that we have established some basic Python programming concepts and have reviewed network programming using sockets, it’s time to apply what we know to applications in common use on the Internet. In the next four topics, we will focus on client side applications for DNS, the web, e-mail and SSL. To be productive in our efforts, we need to make two changes to our approach.
- First, we need to shift our attention to industry standard application level protocols. We will now take TCP/IP and the socket level network programming for granted. Thus our focus will be on the content and format of the data sent between the client and server.
- Secondly, we need to stop trying to re-invent the wheel. The application layer protocols that we will study are very complex and we are certainly not the first programmer to travel down this road. Complete implementations of these protocols have already been written and tested. Don’t worry, we will have plenty of challenges just to understand the basics of the protocols and how we can develop interesting applications.
We begin our study of network technologies in common use on the Internet by focus on client side applications for a couple reasons.
- Client side applications are simpler than the server, and thus a better place to start.
- Far more programmers work on developing client applications than servers. We only need a few programs like Apache or Sendmail, but people are always thinking of new client side applications that fills some need.
When we look at how to write a server in the last topic of the class, we use a much simpler protocol than those related to the web, e-mail and SSL.
We will use Python’s
import statement to load various modules that
do the dirty work of implementing the protocols, including all the socket
programming. When people think about using existing code modules as the basis
for higher level applications, generally two concerns come to mind.
- Some people don’t like working under a framework that others have established. Well, get used to it! Productive programmers always look to see what has already been done before trying to re-implement what others have already done. It may take some time to understand how to work with each module. Sometimes there are choices between modules that do the same thing, so you can find the one that you like best. If the module is well designed, you will quickly get used to it and be able to see that it is saving you from a lot of work. We will use well-established modules that are frequently used by Python developers, so obviously a few other people, besides their authors, think they are pretty good.
- The other concern is in regard to how transferable the knowledge is to other programming languages, such as Java. Well, in some cases, the exact same modules are available for multiple languages. When not, the modules for, say Java, will have much more in common than is different to the Python module used here. If your focus is on the networking technology, what you learn here will serve you well for many years.