Skip to main content
MahiDev — Learn. Build. Become AI-ready.

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.

Advanced25 min
Network overview hero Module 20 Lesson 1 client port and server

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.

The two programs and the address

Example

python
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

  • localhost names this computer, and 127.0.0.1 is 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