Beispiel #1
0
def reader(loop, sock, handler, arg):
    """Register socket reader with the reactor. When the reader has messages,
    the reactor will call the handler, passing the arg. Returns 0 if OK, -1
    if there was an error. If you register the same socket more than once,
    each instance will invoke its corresponding handler."""
    return C.zloop_reader(loop, sock, handler, ffi.new_handle(arg))