def main(): encoder = Encoder() # Register encoder with Pyro naming daemon = Pyro4.Daemon(host=getLanIP()) uri = daemon.register(encoder) ns = Pyro4.locateNS(host=pyro_host,port=pyro_port) try: # Remove any stale bindings in naming # TODO -- do a little more validation, a 'stale' binding may be a host with a duplicate name ns.remove(encoder.getName()) except: pass ns.register(encoder.getName(),uri) daemon.requestLoop()
def main(): encoder = Encoder() # Register encoder with Pyro naming daemon = Pyro4.Daemon(host=getLanIP()) uri = daemon.register(encoder) ns = Pyro4.locateNS(host=pyro_host, port=pyro_port) try: # Remove any stale bindings in naming # TODO -- do a little more validation, a 'stale' binding may be a host with a duplicate name ns.remove(encoder.getName()) except: pass ns.register(encoder.getName(), uri) daemon.requestLoop()
def startCentralEncoder(): """ Start the central server and register it with Pyro """ central = CentralEncoding() daemon = Pyro4.Daemon(host=getLanIP()) uri = daemon.register(central) tries = 0 while(tries < max_tries): try: ns = Pyro4.locateNS(host=pyro_host,port=pyro_port) break except NamingError: tries += 1 if tries >= max_tries: print 'Giving up, too many tries' raise print 'Couldn\'t find naming, waiting for 1 seconds' time.sleep(1) ns.register('central.encoding',uri) daemon.requestLoop()
def startCentralEncoder(): """ Start the central server and register it with Pyro """ central = CentralEncoding() daemon = Pyro4.Daemon(host=getLanIP()) uri = daemon.register(central) tries = 0 while (tries < max_tries): try: ns = Pyro4.locateNS(host=pyro_host, port=pyro_port) break except NamingError: tries += 1 if tries >= max_tries: print 'Giving up, too many tries' raise print 'Couldn\'t find naming, waiting for 1 seconds' time.sleep(1) ns.register('central.encoding', uri) daemon.requestLoop()