3. Topic 1 - Programming with Sockets¶
This topic gives a review of the role of networking protocols and introduces
socket level programming in Python. The Python
socket module is modeled
after the C language socket system calls, so what you learn here is quite
transferable to other programming languages. Although the socket API may seem
complex at first, using it is actually like following a recipe from a cook
book. Once you learn how to set up a socket connection as either the server or
client, you will find that you almost always use the exact same commands.
Once we are able to connect computers with sockets, we want to think about simple protocols that the client and server can use to send meaningful commands and data to each other. The programming project for this topic implements a very simple protocol.
The next four topics after this one use Python modules that provide the implementation of the application layer protocols and thus do all our socket level programming for us. We will write programs that directly work with sockets again when we study servers in Topic 6 – Developing Network Server Programs.
- 3.1. Networking Review
- 3.2. Introduction to Sockets Programming
- 3.3. Programming Assignment 1 – Simple Application Layer Protocol