Last active
June 1, 2025 06:58
-
-
Save raykipkorir/31c6a7ec0d9e86faf3acaec4c6a412c5 to your computer and use it in GitHub Desktop.
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 = 2000 | |
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: | |
s.bind((HOST, PORT)) | |
s.listen() | |
conn, addr = s.accept() | |
with conn: | |
print(f"Connected by {addr}") | |
while True: | |
data = conn.recv(1024) | |
if not data: | |
break | |
conn.sendall(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment