Simple test for PicoTCP's UDP receiver.
Dependencies: PicoTCP lpc1768-picotcp-eth mbed-rtos mbed
Homepage
This project represents the official UDP Rx speed Benchmark for the PicoTCP library.
The linux host is sending 5 frames per milisecond (each frame has 1024 bytes of payload) to a the mbed board(directly connected).
Each time we send a packet, a counter is increased and sent to the receiver, so it can measure the number of packets that were lost during transmission.
The result:
20 seconds Rx statistics
Total bytes received : 47557632
UDP Speed :18.142 Mbit/s
Loss percentage: 36.65 %
The python script used (which you should rename it to PicoTCP_Official_UDP_Rx_Benchmark.py)
import struct import socket import fcntl, os import errno import random, string from time import time, sleep ECHO_SERVER_ADDRESS = "192.168.100.12" NUMBER_OF_SECONDS = 20 LOCAL_SERVER_PORT = 2327 MEGA = 1024*1024. LEN_PACKET = 1024 data = ''.join('\0' for _ in range(LEN_PACKET)) counter = 0 s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM,socket.IPPROTO_UDP) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(('', LOCAL_SERVER_PORT)) print "Started sending data...." print "Time : %d " % time() while True: start = time() cnt = 0 while cnt < 5: list_data = list(data) list_data[3] = chr(counter>>24 & 0xFF) list_data[2] = chr(counter>>16 & 0xFF) list_data[1] = chr(counter>>8 & 0xFF) list_data[0] = chr(counter & 0xFF) data = ''.join(list_data) s.sendto(data, (ECHO_SERVER_ADDRESS, LOCAL_SERVER_PORT)) cnt+=1 counter+=1 sleep(0.001)
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.