if frame.type == 'MSG': # reply doing an echo channel.send_rpy (frame.payload, frame.payload_size, frame.msg_no) return # end default_frame_received # create a vortex.Ctx object ctx = vortex.Ctx () # now, init the context and check status if not ctx.init (): print ("ERROR: Unable to init ctx, failed to continue") sys.exit (-1) # ctx created # register support for a profile vortex.register_profile (ctx, "urn:aspl.es:beep:profiles:my-profile", frame_received=default_frame_received) # start listener and check status listener = vortex.create_listener (ctx, "0.0.0.0", "1602") if not listener.is_ok (): print ("ERROR: failed to start listener, error was was: " + listener.error_msg) sys.exit (-1) # wait for requests vortex.wait_listeners (ctx, unlock_on_signal=True)
# enable tls support vortex.tls.accept_tls (ctx, # accept handler accept_handler=tls_accept_handler, accept_handler_data="test", # cert handler cert_handler=tls_cert_handler, cert_handler_data="test 2", # key handler key_handler=tls_key_handler, key_handler_data="test 3") # enable receiving alive requests if not vortex.alive.init (ctx): error ("Unable to start listener, vortex.alive.init failed..") sys.exit (-1) # create a listener info ("starting listener at 0.0.0.0:44010") listener = vortex.create_listener (ctx, "0.0.0.0", "44010") # check listener started if not listener.is_ok (): error ("ERROR: failed to start listener. Maybe there is another instance running at 44010?") sys.exit (-1) # do a wait operation info ("waiting requests..") vortex.wait_listeners (ctx, unlock_on_signal=True)
ctx, # accept handler accept_handler=tls_accept_handler, accept_handler_data="test", # cert handler cert_handler=tls_cert_handler, cert_handler_data="test 2", # key handler key_handler=tls_key_handler, key_handler_data="test 3") # enable receiving alive requests if not vortex.alive.init(ctx): error("Unable to start listener, vortex.alive.init failed..") sys.exit(-1) # create a listener info("starting listener at 0.0.0.0:44010") listener = vortex.create_listener(ctx, "0.0.0.0", "44010") # check listener started if not listener.is_ok(): error( "ERROR: failed to start listener. Maybe there is another instance running at 44010?" ) sys.exit(-1) # do a wait operation info("waiting requests..") vortex.wait_listeners(ctx, unlock_on_signal=True)
return # end default_frame_received # create a vortex.Ctx object ctx = vortex.Ctx() # now, init the context and check status if not ctx.init(): print("ERROR: Unable to init ctx, failed to continue") sys.exit(-1) # ctx created # register support for a profile vortex.register_profile(ctx, "urn:aspl.es:beep:profiles:my-profile", frame_received=default_frame_received) # start listener and check status listener = vortex.create_listener(ctx, "0.0.0.0", "1602") if not listener.is_ok(): print("ERROR: failed to start listener, error was was: " + listener.error_msg) sys.exit(-1) # wait for requests vortex.wait_listeners(ctx, unlock_on_signal=True)