Python-TCP-client

import socket

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(("10.8.153.30",8081))


while True:
    data = input("请输入给服务器发送的数据")

    client.send(data.encode("utf-8"))
    info = client.recv(1024)
    print("服务器说:",info)

猜你喜欢

转载自blog.csdn.net/huaxiawudi/article/details/81612835