源码来源于python网络编程,但3.x系列再用会有problem
#!/usr/local/bin/python3.5 #coding:utf-8 import socket, sys port = 70 host = sys.argv[1] filename = sys.argv[2] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.sendall((filename + ‘\r\n‘).encode(encoding=‘utf-8‘)) while 1: buf = str(s.recv(2048), ‘utf-8‘) if not len(buf): break sys.stdout.write(buf)
效果图
时间: 2024-10-26 02:24:03