A tool for measuring TCP connection latency between hosts.
This repository contains a simple client-server setup for testing TCP connection latency between different hosts in cloud environments. It's designed to evaluate performance of long-lived TCP connections across various network scenarios.
client/echo_client.py: Python client for sending test data and measuring response timesserver/setup-echo-server.sh: Script to set up and run the echo server
The echo server uses xinetd to provide a simple TCP echo service on port 7.
- SSH into the target host and clone this repository
- Run the setup script with root privileges:
cd server
sudo ./setup-echo-server.shThe script will:
- Install xinetd
- Configure the echo service
- Update the services file if needed
- Configure the firewall (optional)
- Start and enable the xinetd service
The client script sends data to the echo server and measures round-trip time (RTT) with microsecond precision.
python3 client/echo_client.py [host] [port] [options]Required arguments:
host: Echo server hostname or IP addressport: Echo server port (typically 7)
Optional arguments:
--size SIZE: Size of payload in bytes (default: 64)--frequency FREQUENCY: Frequency to send packets in seconds (default: 1.0)--count COUNT: Number of packets to send (default: 0, meaning infinite)--timeout TIMEOUT: Socket timeout in seconds (default: 5.0)--log-dir LOG_DIR: Directory to store log files (default: logs)
Run a test with default settings to a server at 10.0.0.1:
python3 client/echo_client.py 10.0.0.1 7Send 100 packets of 1024 bytes at 0.5-second intervals:
python3 client/echo_client.py 10.0.0.1 7 --size 1024 --frequency 0.5 --count 100The client generates two output files:
- A log file with general information (
logs/echo_client_TIMESTAMP.log) - A CSV file with precise timing data (
logs/echo_client_TIMESTAMP_timings.csv)
The CSV contains columns for:
- packet_num: Sequential packet number
- timestamp: Human-readable timestamp
- send_time_ns: Send time in nanoseconds
- receive_time_ns: Receive time in nanoseconds
- rtt_us: Round-trip time in microseconds