Commit 2229fda8 authored by Denis Bilenko's avatar Denis Bilenko

minor change

parent ef21f2a2
...@@ -42,13 +42,13 @@ def handle_socket(reader, writer): ...@@ -42,13 +42,13 @@ def handle_socket(reader, writer):
print "echoed", x print "echoed", x
print "client disconnected" print "client disconnected"
print "server socket listening on port 6000" if __name__ == '__main__':
server = socket.tcp_listener(('0.0.0.0', 6000)) print "server socket listening on port 6000"
while True: server = socket.tcp_listener(('0.0.0.0', 6000))
try: while True:
new_sock, address = server.accept() try:
except KeyboardInterrupt: new_sock, address = server.accept()
break except KeyboardInterrupt:
# handle every new connection with a new coroutine break
gevent.spawn(handle_socket, new_sock.makefile('r'), new_sock.makefile('w')) # handle every new connection with a new coroutine
gevent.spawn(handle_socket, new_sock.makefile('r'), new_sock.makefile('w'))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment