forked from Arceliar/bmwrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (25 loc) · 754 Bytes
/
main.py
File metadata and controls
31 lines (25 loc) · 754 Bytes
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
#!/usr/bin/python2.7
import outgoing
import incoming
import asyncore
import threading
import sys
import logging
def run():
logging.basicConfig(format='%(asctime)s %(levelname)s - %(message)s', level=logging.DEBUG)
run_event = threading.Event()
run_event.set()
outserv = outgoing.outgoingServer(('localhost', 12345), None)
inserv = incoming.incomingServer('localhost', 12344, run_event)
try:
logging.info("Press Ctrl+C to exit.")
asyncore.loop()
except KeyboardInterrupt:
logging.info("Exiting...")
run_event.clear()
logging.debug("waiting for threads...")
inserv.join()
logging.debug("all threads done...")
sys.exit(0)
if __name__ == '__main__':
run()