client
import socket
soc = socket.socket()
soc.connect(('127.0.0.1', 8080))
while True:
in_s = input('请输入要发送的数据:')
#发送的数据必须是b格式,in_s.encode('utf_8') 把字符串编码成b格式
#把b格式转成字符串
#ss=str(b'hello', encoding='utf'-8)
#ss=b'hello'.decode('utf-8')
#把字符串转成b格式
# by=bytes('hello', encoding='utf-8')
# by='hello'.encode('utf-8')
soc.send(in_s.encode('utf-8'))