#!/usr/bin/python import sys import time import socket host = sys.argv[1] ports = range(7000, 7016) socks = [] for port in ports: sock = socket.socket() sock.bind(('', 0)) sock.connect((host, port)) socks.append(sock) last = time.time() start = last try: history = [] while True: got = 0 for sock in socks: buf = sock.recv(16<<20) got += len(buf) now = time.time() history.append(got / (now - last)) if len(history) > 256: del history[0] last = now print('\r{:.1f} - {:.1f} MB/s'.format(now - start, sum(history) / len(history) / (1024*1024)), end='') except KeyboardInterrupt: print('Test Cancelled')