-
Notifications
You must be signed in to change notification settings - Fork 2
/
s.py
35 lines (28 loc) · 787 Bytes
/
s.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
from rpyc import Service
from rpyc.utils.server import ThreadedServer
from threading import Timer
import threading
class T(Service):
def __init__(self):
super().__init__()
self.conns = []
def on_connect(self, conn):
self.conns.append(conn)
def exposed_set_flag(self):
for i in self.conns:
i.root.set_flag()
def exposed_push(self, tag):
print(tag)
if tag:
print('begin set')
self.conns[0].root.set_v_flag()
print('set success')
def on_disconnect(self, conn):
self.conns.remove(conn)
if __name__ == "__main__":
s = ThreadedServer(
service=T(),
hostname='0.0.0.0',
port=12346
)
s.start()