标签:not ufs pytho from cli socket code while utf-8
test
from socket import *
HOST = ‘127.0.0.1‘
PORT = 21673
BUFSZIE = 1024
ADDR = (HOST, PORT)
tcpCliSock = socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)
while True:
data = input(‘> ‘)
if not data:
break
tcpCliSock.send(data.encode())
data = str(tcpCliSock.recv(BUFSZIE).decode(‘utf-8‘))
if not data:
break
print(data)
标签:not ufs pytho from cli socket code while utf-8
原文地址:https://www.cnblogs.com/Fire-In-Ice/p/9987958.html