Lesson 37: Python Socket Module

The `socket` module lets Python communicate over networks.

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("example.com", 80))
print("Connected to example.com on port 80")
s.close()

This is safe practice if you only connect to your own server or public test servers.

Next Lesson →