Created
July 11, 2022 07:00
-
-
Save xcooper/abf601555180dabea1b48fb80244d47e to your computer and use it in GitHub Desktop.
wait on socket and redirect to stdout
This file contains 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, os, sys | |
addr = ("", 4444) | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(addr) | |
s.listen(1) | |
conn, addr = s.accept() | |
while 1: | |
data = conn.recv(1024) | |
if not data: break | |
sys.stdout.write(data) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment