Courses/Systems Concepts (read-only)

๐Ÿง  Systems Concepts (read-only)

sockets โ€” raw TCP / UDP

The low-level networking primitive under everything.

Almost every networked Python library is built on socket. You rarely use it directly โ€” but knowing it demystifies HTTP, DNS, and async I/O.

import socket
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect(("example.com", 80))
    s.sendall(b"GET / HTTP/1.0\r\nHost: example.com\r\n\r\n")
    data = s.recv(4096)
    print(data[:80])

**Higher-level alternatives**

  • HTTP โ†’ httpx / requests
  • Async TCP โ†’ asyncio.open_connection
  • Many clients โ†’ selectors (level-triggered I/O multiplexing)

> ๐Ÿงช Concept-only here โ€” the browser sandbox has no raw socket access.

Concept lesson

This topic relies on OS features the in-browser Python sandbox can't run (threads, subprocesses, sockets). Read the examples here, then try them in real CPython on your machine.

Sign in to track your progress across lessons.