diff options
Diffstat (limited to 'py/demo/Ice/callback/Server.py')
-rw-r--r-- | py/demo/Ice/callback/Server.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/py/demo/Ice/callback/Server.py b/py/demo/Ice/callback/Server.py new file mode 100644 index 00000000000..5a1f767c276 --- /dev/null +++ b/py/demo/Ice/callback/Server.py @@ -0,0 +1,39 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2004 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, Ice + +Ice.loadSlice('Callback.ice') +import Demo + +class CallbackI(Demo.Callback): + def initiateCallback(self, proxy, current=None): + print "initiating callback" + try: + proxy.callback(current.ctx) + except Ice.Exception, ex: + print ex + + def shutdown(self, current=None): + print "Shutting down..." + try: + current.adapter.getCommunicator().shutdown() + except Ice.Exception, ex: + print ex + +class CallbackServer(Ice.Application): + def run(self, args): + adapter = self.communicator().createObjectAdapter("Callback.Server") + adapter.add(CallbackI(), Ice.stringToIdentity("callback")) + adapter.activate() + self.communicator().waitForShutdown() + return 0 + +app = CallbackServer() +sys.exit(app.main(sys.argv, "config")) |