Created
July 22, 2010 00:46
-
-
Save bcoe/485408 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 thread, time | |
import socket | |
from hackwars.orbited_server.comet import handle_request | |
from orbited import start | |
def listen(): | |
try: | |
comet_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
comet_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
comet_socket.bind( ('', 9000) ) | |
comet_socket.listen(5) | |
while 1: | |
thread.start_new_thread(handle_request, comet_socket.accept()) | |
except Exception, e: | |
print str(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Orbited connects to port 9000 at which point the thread listening to RabbitMQ is spawned off.