Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

## UDP Tester
High-performance UDP traffic generator for Windows with real-time statistics.  
Designed for engineers, testers, and developers who need to measure network performance, latency, jitter, and packet loss at scale.

---

## 🚀 Features

- Multi-threaded high-performance UDP sender
- Supports rate control in **Mbps** or **PPS**
- Configurable payload size and pattern generation
- Token bucket shaper for accurate traffic rate
- Packet loss and out of order counter
- Jitter calculation according to RFC3550 and using standar deviation.
- Latency, jitter and packet loss graph
- Works smoothly on **Windows**

---

## 🧠 How It Works

The script sends UDP packets containing a sequence number and timestamp header.  
If a responder (loopback or echo server) sends them back, latency and jitter are calculated.  
It uses a token bucket algorithm to regulate bandwidth and achieve consistent traffic rates.

A responder script is provided as well.

---

## ⚙️ Usage

### Basic Example

```bash
python3 sender.py 192.168.1.100 --port 9999 --mbps 750 --payload-size 512 --pattern prbs --flows 1 --duration 10

python3 responder.py --host 192.168.1.100 --port 9999

---

## ⚙️ Options

--host Destination IP or hostname.
--port: Destination port on the receiver (some receiver dont use it, but the sender still needs it), default=9999.
--local-port: local source port to bind (0 = auto).
--pps: Amount of packets per second to be send.
--mbps: Rate of the transmision.
--payload-size: Payload size of the packet, without the headers.
--pattern: Testing pattern of bits to be send.
--flows: Amount of flows to be created between the sender and receiver.
--sndbuf: Amount of memory in bytes, the operating system reserves for outgoing network data on a socket.
--tos: Type of service.
--duration: sending duration (seconds).
--extra: extra seconds to keep receiver listening after send ends.
--verbose: To print all the logs on the console.


---

## TCP Tester
High-performance TCP traffic generator and echo responder with real-time statistics and optional deep TCP analysis.  
Designed for engineers, testers, and developers who need to measure TCP performance, latency, retransmissions, stalls, and throughput accurately.

TCP data obtained is not round-trip, it is taken from the client to the server or from the server to client.
---

## 🚀 Features

## TCP Sender

- High-performance TCP traffic generator
- Supports rate control in Mbps or PPS
- Accurate rate control using token bucket shaping
- Measures:
  - RTT (latency)
  - Throughput (TX and RX Mbps)
  - Frame loss
  - Send stalls
- Real-time throughput monitoring
- RTT and throughput graphs
- Configurable:
  - Payload size
  - Payload pattern
  - Socket buffer sizes
  - TCP_NODELAY option
- Works on Windows, Linux, and macOS


## TCP Responder

- High-performance TCP echo server (Linux)
- Echoes frames exactly as received
- Detects send stalls on echo
- Optional TCP capture using tcpdump
- Optional TCP analysis using tshark
- Counts:
  - Retransmissions
  - Fast retransmissions
  - Duplicate ACKs
  - Zero window events
  - Out-of-order packets
  - Window full conditions
- Sends final JSON summary to sender automatically


---

## 🧠 How It Works

The sender transmits TCP frames containing:

- Sequence number
- Timestamp
- Payload

The responder echoes each frame back immediately.

The sender measures:

- RTT
- Throughput
- Frame loss
- Send stalls

When transmission ends, the responder analyzes captured TCP traffic (optional) and sends a final JSON summary over the same TCP connection.

---

## ⚙️ Usage

Start responder (Linux):

sudo python3 Responder_TCP.py --port 9999 --timeout 20

With TCP analysis enabled:

sudo python3 Responder_TCP.py --port 9999 --pcap --iface eth1 --pcap-dir c2s --timeout 20


Start sender (Windows/Linux/macOS):

Example using Mbps:

python Sender_TCP.py 192.168.1.120 --port 9999 --mbps 20 --payload-size 1250 --nodelay --duration 20 --extra 30 --timeout 35

Example using PPS:

python Sender_TCP.py.py 192.168.1.120 --port 9999 --pps 50000 --payload-size 1250 --nodelay --duration 20 --extra 30 --timeout 35

---

## ⚙️ Sender Options

host             Destination IP or hostname
--port           Destination port, default=9999
--pps            Frames per second
--mbps           Transmission rate in Mbps
--payload-size   Payload size in bytes
--pattern        Payload pattern: zeros, ones, prbs, random, ascii, hex
--sndbuf         TCP send buffer size in bytes
--rcvbuf         TCP receive buffer size in bytes
--nodelay        Disable Nagle algorithm
--duration       Transmission duration (seconds)
--extra          Time to wait for responder summary (seconds)
--timeout        Socket timeout
--stall-ms       Stall detection threshold in milliseconds
--verbose        Enable verbose logging


---

## ⚙️ Responder Options

--host           Bind address, default=0.0.0.0
--port           Listen port, default=9999
--pcap           Enable tcpdump capture and tshark analysis
--iface          Network interface for capture
--pcap-dir       Analysis direction: any, s2c, c2s
--timeout        Socket timeout
--stall-ms       Echo stall detection threshold
--verbose        Enable verbose logging


---

## 📊 Example Output

Sender statistics:

TCP Traffic Statistics (Final):
Metric                             Value
--------------------------------------------------------------------
Flows connected                    1
Total TX Frames                    32114
Total RX Frames                    32114
Echo loss (TX-RX)                  0 (0.00%)
Min RTT (ms)                       154.217
Max RTT (ms)                       3154.608
Mean RTT (ms)                      433.476
StdDev RTT (ms)                    461.769
Send stalls (>= ms)                18 (threshold=50.0 ms)

Responder Final TCP Summary (over TCP):
{
    "type": "final_tcp_summary",
    "server_ip": "192.168.1.120",
    "pcap_enabled": true,
    "pcap_dir": "c2s",
    "client_addr": {
        "ip": "192.168.1.150",
        "port": 50763
    },
    "rx_frames": 32114,
    "tx_frames": 32114,
    "rx_bytes": 40784780,
    "tx_bytes": 40784780,
    "send_stalls_ge_ms": 50.0,
    "send_stalls_ge_ms": 50.0,
    "send_stalls_count": 0,
    "send_stall_max_ms": 0.0,
    "tcp_analysis": {
        "zero_window": 0,
        "window_update": 193,
        "window_full": 0,
        "retransmission": 450,
        "duplicate_ack": 676,
        "fast_retransmission": 17,
        "out_of_order": 109
    },
    "pcap_file_on_server": "tcp_1771044341_192.168.1.150_50763.pcap"
}


---

## 📁 PCAP Capture (Optional)

When enabled, responder generates:

tcp_<timestamp>_<client_ip>_<port>.pcap

These files can be opened in Wireshark.


---

## 🖥 Supported Platforms

Sender:
- Windows
- Linux
- macOS

Responder:
- Linux (recommended)


---

## 🎯 Use Cases

- TCP performance testing
- Network troubleshooting
- Router and firewall validation
- TCP retransmission analysis
- Buffer tuning validation
- NIC and OS performance testing
- Datacenter and ISP network testing


---

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages