def registerMe(name):
global sock, tcp_ip, tcp_port
inf = open('config.txt', 'r')
config = inf.readline()
tcp_ip, tcp_port = config.split(' ')
tcp_port = int(tcp_port)
sock.connect((tcp_ip, tcp_port))
data = sock.recv(MAX_LENGTH)
# id = json.loads(str(decompress(data), 'utf-8'))['id']
id = json.loads(str(data, 'utf-8'))['id']
jdata = dict()
jdata['name'] = name
s = json.dumps(jdata)
# sock.send(compress(bytes(s + '\n', 'utf-8')))
sock.send(bytes(s + '\n', 'utf-8'))
return id
client_protocol.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录