wu_xinjun
2022-03-07 e1f883778b1a51241a018a7f0c5918f91026aae7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os, sys
import threading
 
# add python path of src to sys.path
src_path = os.path.join(__file__, *(['..'] * 2))
src_path = os.path.abspath(src_path)
sys.path.insert(0, src_path)
 
from microwave.servers import MicroWaveUDPServer
 
 
class MicroWaveUDPThread (threading.Thread):
    def __init__(self, server_address, msg_queue):
        threading.Thread.__init__(self)
        self.udp_server = MicroWaveUDPServer(server_address, msg_queue)
 
    def run(self):
        print("MicroWaveUDPThread started")
        self.udp_server.serve_forever()
 
    def stop(self):
        self.udp_server.server_close()