I&C SCI 32 Lecture Notes - Lecture 4: Domain Name System, Loopback, Connect Four
Document Summary
In previous coursework, and earlier this quarter, you"ve seen one way that programs can read external input: by opening and reading from files. Python standard library includes a number of tools that we can use to help us write. Python programs that can do many of the same things that our favorite internet- connected programs do. As a first step, we"ll start with the tool atop which most of the others are built: sockets. Sockets provide an abstraction of a connection between a program and some other program. Sockets can be used to represent many different kinds of network connections that behave quite differently from one another, but we"ll be using them in a particular way. There are variations on what is described here, but these assumptions will serve us well. When two programs are connected via sockets, each program has a socket representing its end of the connection between them, with each socket having two streams available: