Lesson 01
Network Overview
Learn what a Python network program is for, and how a server, a client, a host name, an IP address, and a port number fit together.
Learn what a Python network program is for, and how a server, a client, a host name, an IP address, and a port number fit together.
Example
host = "localhost"
ip = "127.0.0.1"
port = 5050
print(host)
print(ip)
print(port)The prints are localhost, 127.0.0.1, and 5050. A network program exists to share a message between two programs. The client sends the request. The server reads it, does the work, and sends the reply. localhost is the name of this computer. 127.0.0.1 is the loopback address for this same computer. A port is the number the server listens on. The course notes call the machine name a DNS. The accurate name is a host name. DNS is the system that turns a host name into an IP address.
Key takeaways
-
A network program shares a message between a client and a server
-
The server reads a request and sends a reply
-
The client sends the request and reads the reply
-
localhostnames this computer, and127.0.0.1is its loopback address -
A port is the number where that server listens
-
Next: Socket Calls — create a socket and turn text into bytes
-
Previous: Thread Locks
Loading playground…
Check your understanding
Network Overview Quiz
What is the purpose of a network program in this lesson?
1 / 10