-
Notifications
You must be signed in to change notification settings - Fork 1
/
rpc_server.py
41 lines (31 loc) · 834 Bytes
/
rpc_server.py
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from SimpleXMLRPCServer import SimpleXMLRPCServer
# server URL
server = SimpleXMLRPCServer(('localhost', 8081), allow_none=True)
class DelayHandler:
# set delay in left branch
def set_left_delay(self, val):
self.delay_left = val
print self.delay_left
return True
# set delay in right branch
def set_right_delay(self, val):
self.delay_right= val
return True
# set client choice
def set_exit_choice(self, val):
self.exit_choice = val
return True
# get delays
def get_delays(self):
delay_tup = (self.delay_left, self.delay_right)
return delay_tup
# display received string
#def disp_msg(message):
# print message
#server.register_function(disp_msg)
server.register_instance(DelayHandler())
try:
print 'Use Control-C to exit'
server.serve_forever()
except KeyboardInterrupt:
print 'Exiting'