def main(): verbose = '-v' in sys.argv client = MajorDomoClient("tcp://localhost:5555", verbose) request = b"sq" reply = client.send(b"mmi.service", request) if reply: replycode = reply[0].decode() print("Lookup echo services:", replycode) else: print("E: no response from broker, make sure it's running")
def main(): verbose = '-v' in sys.argv client = MajorDomoClient("tcp://localhost:5555", verbose) request = "echo" reply = client.send("mmi.service", request) if reply: replycode = reply[0] print "Lookup echo service:", replycode else: print "E: no response from broker, make sure it's running"
def main(): verbose = '-v' in sys.argv request = b"echo" for arg in sys.argv: if arg.startswith('-s='): request = arg.split('=')[1].encode() client = MajorDomoClient("tcp://localhost:5555", verbose) reply = client.send(b"mmi.service", request) if reply: replycode = reply[0] print(f"Lookup echo service: {replycode.decode()}") else: print("E: no response from broker, make sure it's running")
def main(): verbose = '-v' in sys.argv client = MajorDomoClient("tcp://localhost:5555", verbose) requests = 100000 for i in range(requests): request = b"Hello world" try: client.send(b"echo", request) except KeyboardInterrupt: print("send interrupted, aborting") return count = 0 while count < requests: try: reply = client.recv() except KeyboardInterrupt: break else: # also break on failure to reply: if reply is None: break count += 1 print("%i requests/replies processed" % count)
def main(): verbose = '-v' in sys.argv client = MajorDomoClient("tcp://localhost:5555", verbose) count = 0 while count < 100000: request = "Hello world" try: reply = client.send("echo", request) except KeyboardInterrupt: break else: # also break on failure to reply: if reply is None: break count += 1 print "%i requests/replies processed" % count
def main(): verbose = '-v' in sys.argv client = MajorDomoClient("tcp://localhost:5555", verbose) count = 0 while count < 10000: request = str(random.randint(100, 200)).encode() try: reply = client.send(b"square", request) print("2", request.decode(), reply[0].decode()) if count < 10: time.sleep(1) except KeyboardInterrupt: break else: # also break on failure to reply: if reply is None: break count += 1 print ("%i requests/replies processed" % count)