Skip to content

Instantly share code, notes, and snippets.

@demensdeum
Created September 11, 2025 16:31
Show Gist options
  • Select an option

  • Save demensdeum/661f81c32ff1fb766f3f679aa2f4c1ae to your computer and use it in GitHub Desktop.

Select an option

Save demensdeum/661f81c32ff1fb766f3f679aa2f4c1ae to your computer and use it in GitHub Desktop.
simple-udp-print-server-python.py
import socket
HOST = "127.0.0.1"
PORT = 8080
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
sock.bind((HOST, PORT))
print(f"UDP server listening on {HOST}:{PORT}...")
while True:
data, addr = sock.recvfrom(1024)
print(f"Received message from {addr}: '{data.decode()}'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment