mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-04-22 14:59:09 +00:00
16 lines
498 B
Python
16 lines
498 B
Python
import socket
|
|
import time
|
|
|
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
|
s.bind(('0.0.0.0', 1337))
|
|
s.listen()
|
|
conn, addr = s.accept()
|
|
with conn:
|
|
while True:
|
|
data = conn.recv(1024)
|
|
if not data:
|
|
break
|
|
print(data.decode())
|
|
time.sleep(3)
|
|
conn.sendall('This will still be received by the client that has closed its write end'.encode())
|