File: client.py

package info (click to toggle)
pyro 1%3A3.14-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,048 kB
  • ctags: 1,988
  • sloc: python: 11,194; xml: 128; sh: 52; makefile: 28
file content (25 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
import sys, os

sys.path.insert(0, os.pardir)	# to find testclient.py

import testclient

fact = testclient.getproxy('factory')

print 'Local Python PID =', os.getpid()

c1=fact.create('Opel')
c2=fact.create('Ford')
c3=fact.create('Honda')

print 'Factory produced three cars (of three different brands).'
print 'Each object\'s PID is printed after its name. The PID'
print 'is different than the local Python PID above: its the PID'
print 'from the server process (the factory) that produced them!'
print '(look in the server window to see what its PID is).'
print c1.name(), 'pid=',c1.pid()
print c2.name(), 'pid=',c2.pid()
print c3.name(), 'pid=',c3.pid()