def concurrent_func(text):
for i in range(5):
print text, 'STEP', i
yield
coreasync.dispatch_concurrent(lambda: concurrent_func("Context 1"))
coreasync.dispatch_concurrent(lambda: concurrent_func("Context 2"))
coreasync.runloop()
Package contains a small Async HTTP Server implementation that you can easily use:
def handle_response(socket, addr, request, headers, body): yield socket.send(...) def handle_error(socket, addr, error): yield socket.send(...) coreasync.httpserver.httpServerLoop(HOST, PORT, handle_response, handle_error) print 'HTTP Server is Running on', HOST, PORT coreasync.runloop()
You can find Source Code and Examples at GitHub:
git clone http://github.com/matteobertozzi/netstack-coreasync.git
Exactly what I need for my current project :D (you know what I'm talking about :P)
ReplyDelete