summaryrefslogtreecommitdiff
path: root/py/demo/book/printer/Server.py
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2007-08-30 13:37:21 -0230
committerDwayne Boone <dwayne@zeroc.com>2007-08-30 13:37:21 -0230
commit16a985e3a93121f17d8025492472d51a7906c46a (patch)
tree5b158e09637562b2fb1ec662d4afcd69e257a3a0 /py/demo/book/printer/Server.py
parentSquashed commit of the following: (diff)
downloadice-16a985e3a93121f17d8025492472d51a7906c46a.tar.bz2
ice-16a985e3a93121f17d8025492472d51a7906c46a.tar.xz
ice-16a985e3a93121f17d8025492472d51a7906c46a.zip
bug 2347 - added book demos to python
Diffstat (limited to 'py/demo/book/printer/Server.py')
-rw-r--r--py/demo/book/printer/Server.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/py/demo/book/printer/Server.py b/py/demo/book/printer/Server.py
new file mode 100644
index 00000000000..39f3ae8025d
--- /dev/null
+++ b/py/demo/book/printer/Server.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2007 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, traceback, Ice
+
+Ice.loadSlice('Printer.ice')
+import Demo
+
+class PrinterI(Demo.Printer):
+ def printString(self, s, current=None):
+ print s
+
+status = 0
+ice = None
+try:
+ ic = Ice.initialize(sys.argv)
+ adapter = ic.createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000")
+ object = PrinterI()
+ adapter.add(object, ic.stringToIdentity("SimplePrinter"))
+ adapter.activate()
+ ic.waitForShutdown()
+except:
+ traceback.print_exec()
+ status = 1
+
+if ic:
+ # Clean up
+ try:
+ ic.destroy()
+ except:
+ traceback.print_exec()
+ status = 1
+
+sys.exit(status)