mirror of
https://github.com/php-win-ext/phpy.git
synced 2026-03-24 08:52:08 +01:00
17 lines
362 B
Python
17 lines
362 B
Python
import socket
|
|
|
|
HOST = "127.0.0.1"
|
|
PORT = 5432
|
|
|
|
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)
|