Created
September 11, 2025 16:31
-
-
Save demensdeum/661f81c32ff1fb766f3f679aa2f4c1ae to your computer and use it in GitHub Desktop.
simple-udp-print-server-python.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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