#!/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) sock.bind(('127.0.0.1', 999)) sock.listen(10) conn, addr = sock.accept() nr_written=0 while 1: conn.sendall(b"a response line of text") data = conn.recv(1024) if not data: break # sleep 200us time.sleep(200/1000000) nr_written = nr_written+1