-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
30 lines (24 loc) · 793 Bytes
/
client.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
import socket
import threading
import re
host = "127.0.0.1"
port = 1550
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
UserGude = ("-exit :exit program\n" +
"-new$<channel name> :create new channel\n" +
"-list :channel list\n" +
"-join$<channel name> :join to channel\n" +
"-left$<channel name> :left from channel\n" +
"#<partner name>%massage :Chat by Special user\n")
nick = str(input("welcome, enter your name :"))
print("Hi " + nick + ",\n" + UserGude)
def printMessage():
msg = str(input(""))
msg = nick + ":" + msg
s.send(msg.encode())
while True:
threading._start_new_thread(printMessage, ())
data = s.recv(1024)
print(str(data)[2:-1].replace("^", "\n"))
s.close()