TCP网络程序 - 客户端
import socket
# 创建socket
tcp_client_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
# 建立连接
addr_s = ('192.168.124.35',8080)
tcp_client_socket.connect(addr_s)
# 发送数据
context_bit ='wow'.encode()
tcp_client_socket.send(context_bit)
# 接收数据
recv_data = tcp_client_socket.recv(1024)
recv_data = recv_data.decode('GBK')
print('收到数据:' + recv_data)
# 关闭socket
tcp_client_socket.close()