TCP Official Rx Benchmark

Dependencies:   PicoTCP lpc1768-picotcp-eth mbed-rtos mbed

This project represents a the official TCP Rx Benchmark for the PicoTCP library.

The mbed board is receiving one Megabyte from the other side and we measure how fast it does that.

The result:
RX Throughput: 1048576 bytes in < 1 seconds (20.236)Mbits/s

The python script used (which you should rename it to PicoTCP_Official_TCP_Rx_Benchmark.py)

#!/usr/bin/python
import sys, socket
import random, string
import select
from time import time
#ECHO_SERVER_ADDRESS = "10.20.30.139"
ECHO_SERVER_ADDRESS = "192.168.100.12"
ECHO_SERVER_PORT = 7
N_PACKETS = 1024
LEN_PACKET = 1024

TOT_BITS = (LEN_PACKET * N_PACKETS * 8) # TX bits + RX bits
PACKET = ''.join(random.choice(string.ascii_uppercase+string.digits) for _ in range(LEN_PACKET))
MEGA = 1024 * 1024.
UPDATE_STEP = (N_PACKETS/20) # Make the update step such as one step = 5%
UPDATE_R_STEP = (N_PACKETS/100) #Make the update step such as one step = 1%
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT))
start = time()
rx_total = 0
tx_total = 0
data = ''
i = 0
lp = []
p = select.poll()
while(True): # keeping this in for robustness testing, when the test will run for days
	#Stage I - sending data from host towards mbed board	
	print "Started sending data...."
	while (i < N_PACKETS):
	  p.register(s, select.POLLOUT)
	  lp = p.poll(1)
	  if (len(lp) > 0):
	    s.sendall(PACKET)
	    i+=1
	    if (i % UPDATE_STEP) == 0: print "sent %d/%d (%.2f%%)" % (i, N_PACKETS, float(i)/ float(N_PACKETS) * 100.)
	    continue

	print "Test was finished!"
	break;	

t = time() - start
s.close()
print "RX Throughput: %d bytes in %d seconds (%.3f)Mbits/s" % (TOT_BITS / 8, t, ((TOT_BITS / t) / MEGA))

This test is based on the following libraries

Import librarylpc1768-picotcp-eth

A PicoTCP driver for the lpc1768 mbed board

Import libraryPicoTCP

Free (GPLv2) TCP/IP stack developed by TASS Belgium

Import librarymbed-rtos

Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.