forked from AllenDowney/ThinkPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathServer.py
More file actions
23 lines (17 loc) · 600 Bytes
/
Copy pathMathServer.py
File metadata and controls
23 lines (17 loc) · 600 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Example using the remote_object wrapper for Pyro.
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import sys
import remote_object
class MathServer(remote_object.RemoteObject):
def mul(s, arg1, arg2): return arg1*arg2
def add(s, arg1, arg2): return arg1+arg2
def sub(s, arg1, arg2): return arg1-arg2
def div(s, arg1, arg2): return arg1/arg2
def main(script, name='bob', *args):
print 'Starting MathServer %s...' % name
server = MathServer(name)
server.requestLoop()
if __name__ == '__main__':
main(*sys.argv)