def main(): poller = Poller() pollable = EchoPollable(poller) pollable.attach(0) pollable.set_timeout(7.0) pollable.set_readable() poller.loop() pollable.close()
def main(): """ Main function """ poller = Poller() if not poller: sys.exit("connection - cannot construct the poller") proto = MyProtocol(poller) if not proto: sys.exit("connection - cannot construct the protocol") proto.connection = Connection.attach(proto, 0) if not proto.connection: sys.exit("connection - cannot attach the connection") result = proto.connection.set_timeout(7.0) if result != 0: sys.exit("connection - cannot set the timeout") if proto.connection.enable_read() != 0: sys.exit("connection - cannot enable read") poller.loop()
def main(): poller = Poller() poller.defer_read(0, read_ok, read_timeo, poller, 10.0) poller.loop()
def main(): """ Main function """ poller = Poller() poller.resolve("PF_INET", "www.youtube.com", resolve_callback, poller) poller.loop()
def main(): """ Main function """ poller = Poller() EchoServer(poller, 0, "127.0.0.1", "12345") poller.loop()
def main(): """ Main function """ poller = Poller() poller.sched(1.0, periodic_callback, poller) poller.loop()