The example in asyncio documentation only shows how to write echo server in
twisted style, and i wonder how can i write server handler as a coroutine
like in gevent, something like:

def handle_client(transport):
    while True:
        buf = yield from transport.read(4096)
        # handle request

        # read some result from database without blocking other coroutine.
        result = yield from block_read_from_database()

loop.create_server(handle_client, '127.0.0.1', 3000)


Thanks.

-- 
http://yi-programmer.com/

Reply via email to