标签:cep lis client pre input python NPU import 发送
import socket tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.connect((‘127.0.0.1‘, 12345)) while True: tcp_socket.send(input(‘你输入要回显的数据:‘).encode()) print(‘回显数据:‘, tcp_socket.recv(1024).decode())
import socket tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) tcp_socket.bind((‘‘,12345)) tcp_socket.listen(128) tcp_server, client_addr = tcp_socket.accept() while True: print(client_addr, ‘连接成功‘) serve_recv = tcp_server.recv(1024) tcp_server.send(serve_recv)
标签:cep lis client pre input python NPU import 发送
原文地址:https://www.cnblogs.com/wf-skylark/p/9104462.html