File: server.py

package info (click to toggle)
python-orbit 0.3.1-12
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,492 kB
  • ctags: 801
  • sloc: sh: 9,444; ansic: 5,642; python: 1,141; makefile: 126
file content (18 lines) | stat: -rwxr-xr-x 453 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python

import random, CORBA
from _GlobalIDL__POA import Echo 

class Echo_Impl(Echo):

	def echoString(self, astring):
		outnum = random.randint(0, 100) / 100.0
		print "[server] %s -> %f" % (astring, outnum)
		return self._this(), outnum

orb = CORBA.ORB_init()
servant = Echo_Impl()
open("ior", "w").write(orb.object_to_string( servant._this() ))
poa = orb.resolve_initial_references("RootPOA")
poa.the_POAManager.activate()
orb.run()