Untitled

mail@pastecode.io avatar
unknown
python
6 days ago
988 B
1
Indexable
Never
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()
Leave a Comment