-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (23 loc) · 708 Bytes
/
Copy pathmain.py
File metadata and controls
26 lines (23 loc) · 708 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
import os
import threading
import server
import clients.desktop
import sys
# Set '01_PORT' if it's not already set
if '01_PORT' not in os.environ:
os.environ['01_PORT'] = '10000'
# Check if --server argument is passed
if '--server' in sys.argv:
# Create and run server thread only
server_thread = threading.Thread(target=server.run)
server_thread.start()
server_thread.join()
else:
# Create threads for server and client
server_thread = threading.Thread(target=server.run)
client_thread = threading.Thread(target=clients.desktop.run)
# Start and wait for the threads
server_thread.start()
client_thread.start()
server_thread.join()
client_thread.join()