Untitled

 avatar
unknown
python
a year ago
988 B
4
Indexable
def run(communicator):
    sender = Demo.CallbackSenderPrx.checkedCast(
        communicator.propertyToProxy('CallbackSender.Proxy').
        ice_twoway().ice_secure(False))
    if not sender:
        print("invalid proxy")
        sys.exit(1)

    adapter = communicator.createObjectAdapter("Callback.Client")
    adapter.add(CallbackReceiverI(), Ice.stringToIdentity("callbackReceiver"))
    adapter.activate()

    receiver = Demo.CallbackReceiverPrx.uncheckedCast(
        adapter.createProxy(Ice.stringToIdentity("callbackReceiver")))

    menu()

    c = None
    while c != 'x':
        sys.stdout.write("==> ")
        sys.stdout.flush()
        c = sys.stdin.readline().strip()
        if c == 't':
            sender.initiateCallback(receiver)
        elif c == 's':
            sender.shutdown()
        elif c == 'x':
            pass  # Nothing to do
        elif c == '?':
            menu()
        else:
            print("unknown command `" + c + "'")
            menu()
Editor is loading...
Leave a Comment