TCP Speed Test Application
Overview
This is a TCP speed test application designed for NetBurner embedded devices. The application creates a TCP server that measures network transmission performance by sending data to connected clients. It's designed to test the send speed capabilities of NetBurner hardware.
Features
- TCP server listening on configurable port (default: 1234)
- Automatic data buffer initialization with test patterns
- Network interface detection and IP address display
- Optional WiFi interface support
- Socket optimization for performance testing
- Real-time throughput measurement and reporting
- Client connection management with timeout handling
Hardware Requirements
- NetBurner embedded device
- Ethernet or WiFi network connectivity
- Debug serial port for monitoring
Software Components
Key Functions
Network Initialization
- Waits for active network connection
- Displays IP addresses of available interfaces
- Optional WiFi interface initialization (when ADD_WIFITEST is defined)
TCP Server Operation
- Creates listening socket on specified port
- Accepts incoming client connections
- Configures socket options for optimal performance:
- Enables SO_NOPUSH option
- Sets ACK buffers to 20
- Sets TX buffers to 20
Speed Test Protocol
- Server waits for client start signal (single byte)
- Continuously sends 1460-byte data packets
- Measures transmission time and byte count
- Reports results when client disconnects
Data Pattern
- Test data consists of repeating ASCII characters ('A' + (index % 64))
- Creates predictable pattern for data integrity verification
Usage Instructions
Device Setup
- Connect NetBurner device to network
- Connect to debug serial port using terminal (MTTTY recommended)
- Build and download the application to the device
- Device will display its IP address and listening status
Running Speed Test
- Note the IP address displayed by the device
- Use the provided TcpSpeedTest.exe PC application:
./TcpSpeedTest <ip_address>
- Add
-r flag for continuous testing: ./TcpSpeedTest <ip_address> -r
Test Results
- Results displayed on both device serial output and PC command prompt
- Metrics include:
- Total bytes sent
- Time duration (in system ticks and seconds)
- Calculated throughput
Configuration Options
WiFi Support
Uncomment #define ADD_WIFITEST to enable WiFi interface:
- Scans and displays available networks
- Attempts connection to configured network
- Note: Enable FAST_WIFI_STACK in constants.h for improved performance
Performance Optimization
- FlexSPI overclock option available (commented by default)
- Socket buffer optimization enabled
- System diagnostics available for debugging
Error Handling
- Connection timeout handling (10-second timeout for start signal)
- Socket operation error detection
- Graceful connection termination
- Automatic server restart after client disconnect
Performance Notes
- Uses aligned memory buffers for optimal performance
- Implements socket options for reduced latency
- Sends data in optimal 1460-byte chunks (standard Ethernet MTU)
- Continuous operation until manual reset
Troubleshooting
Common Issues
- No network connection: Check cable/WiFi configuration
- Port binding failure: Verify port 1234 is available
- Client connection timeout: Ensure PC application can reach device IP
- Performance issues: Consider enabling FAST_WIFI_STACK for WiFi
Debug Information
- Verbose mode available (set bVerbose = TRUE)
- System diagnostics enabled by default
- Serial output provides detailed connection status