-
-
Save rectalogic/a65575302683df98dbe1 to your computer and use it in GitHub Desktop.
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 threading | |
import socket | |
import Queue | |
def accept(): | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
s.bind(("", 65021)) | |
s.listen(5) | |
s.accept() | |
t = threading.Thread(target=accept) | |
t.setDaemon(True) | |
t.start() | |
q = Queue.Queue() | |
while True: | |
try: | |
q.get(timeout=100000) | |
except Queue.Empty: | |
print "Empty" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment