#!/bin/python3 import socket import sys import struct, fcntl, os import os, errno, time import time sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = ('127.0.0.1', 999) print ("connecting to 127.0.0.1") sock.connect(server_address) nr_writes = 0 start_time = time.clock_gettime(time.CLOCK_MONOTONIC) while nr_writes < 90000: data = sock.recv(4096) if len(data) == 0: print("connection closed!\n"); exit(0); # sleep 20us time.sleep(20/1000000) sock.send(data) nr_writes = nr_writes+1 end_time = time.clock_gettime(time.CLOCK_MONOTONIC) delta = end_time - start_time print(delta)