-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (32 loc) · 1.01 KB
/
main.py
File metadata and controls
58 lines (32 loc) · 1.01 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from client import Client
import sys
import threading
import time
# host local '10.57.33.239'
HOST = '192.168.0.23' #IP address server machine
PORT = 3042
client = Client(HOST,PORT)
menu_options = {"1":"Send message", "q": "quit"}
def show_menu():
print("--MENU--")
for item in menu_options.items():
print(item[0], ":", item[1])
def choose_option():
while(True):
show_menu()
choice = input("Choose option")
if(choice =="1"):
client.send_message()
elif(choice =="q" or choice == "Q"):
client.disconnect()
sys.exit()
# send_message_thread = threading.Thread(target=choose_option)
# send_message_thread.start()
# send_message_thread.join()
receive_message_thread = threading.Thread(target=client.receive_message)
receive_message_thread.start()
client.send_message()
# client.send_message("test1")
# client.send_message("test2")
# client.send_message("test3")
# client.send_message("test")