Last active
January 10, 2020 07:29
-
-
Save ph1ee/517fc5538e582b3d102171f370f55d4b to your computer and use it in GitHub Desktop.
simple discard daemon
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
#!/usr/bin/env python3 | |
import socketserver | |
class TCPHandler(socketserver.StreamRequestHandler): | |
def handle(self): | |
while self.rfile.read(1): | |
pass | |
if __name__ == "__main__": | |
HOST, PORT = "0.0.0.0", 9999 | |
# Create the server, binding to localhost on port 9999 | |
server = socketserver.TCPServer((HOST, PORT), TCPHandler) | |
server.allow_reuse_address = True | |
# Activate the server; this will keep running until you | |
# interrupt the program with Ctrl-C | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment