Software Design by Example in Python 21: Transferring Files
A week ago I wrote that learning how to write a web browser will teach you more about modern computer systems than learning how to write a compiler. One reason for that is that almost modern application relies on networks, so understanding how they work is at least as important as understanding register allocation.
Chapter 21: Transferring Files therefore has three parts:
- How to transfer a file using TCP/IP.
- How to break large transfers into chunks.
- How to write unit tests when multiple processes are involved.
Of these, I think the third is the hardest and therefore the most important. My approach in this chapter is to stub out the client when testing the server and vice versa; it reduces the fidelity of the tests, but it’s one of the few times I haven’t felt uncomfortable using multiple inheritance.
Terms defined: client, deadlock, Domain Name System, Internet Protocol, IP address, port, server, socket, test fidelity, Transmission Control Protocol.