@@ -0,0 +1,1434 @@
+%22%22%22%0AThis example is relatively complex.%0A%0AWe will be creating a system in which agents will connect to different%0Aname servers. Each name server will therefore represent a 'group' of agents.%0AThat way, we can easily shut down all agents belonging to a group, without%0Ainterfering with the others.%0A%22%22%22%0Aimport time%0A%0Afrom osbrain import run_agent%0Afrom osbrain import run_nameserver%0A%0A%0Adef annoy(agent, message):%0A    agent.send('annoy', message)%0A%0A%0Adef log_message(agent, message):%0A    agent.log_info('Received: %25s' %25 message)%0A%0A%0Aif __name__ == '__main__':%0A%0A    ns = run_nameserver()%0A    ns_annoy = run_nameserver()%0A%0A    # Create normal PUB/SUB communication%0A    listener = run_agent('listener', nsaddr=ns.addr())%0A    addr = listener.bind('SUB', alias='sub', handler=log_message)%0A%0A    speaker = run_agent('speaker', nsaddr=ns.addr())%0A    speaker.connect(addr, alias='annoy')%0A    speaker.each(0.2, annoy, 'Blah blah...')%0A%0A    # Create annoying agents registered in another name server%0A    annoyer_apple = run_agent('annoyer0', nsaddr=ns_annoy.addr())%0A    annoyer_apple.connect(addr, alias='annoy')%0A    annoyer_apple.each(0.2, annoy, 'apple')%0A%0A    annoyer_grape = run_agent('annoyer1', nsaddr=ns_annoy.addr())%0A    annoyer_grape.connect(addr, alias='annoy')%0A    annoyer_grape.each(0.2, annoy, 'grape')%0A%0A    time.sleep(1)%0A    # Shutting down the annoying agents through their name server%0A    ns_annoy.shutdown()%0A%0A    time.sleep(1)%0A    ns.shutdown()%0A

Add example of various name servers from one script